Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-06-14 14:01:57 -0400
committerPaul Pazderski2019-06-15 11:17:08 -0400
commit1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857 (patch)
tree7552c5a980252e5ed0a5e4c04bd4ff34d824a028
parent3a934d23cb1afac1bb9cc7302248ee2c3f126ed3 (diff)
downloadeclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.tar.gz
eclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.tar.xz
eclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.zip
Use jdk 5 for-each loopI20190616-1800I20190615-1800
Replace simple uses of Iterator with a corresponding for-each loop. Also add missing braces on loops as necessary. Change-Id: I8cee98245fb49892d80949d1dcda89c9bf72f3e4 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java24
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java3
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java36
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/HunkResult.java4
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java12
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java24
-rw-r--r--bundles/org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer/RangeDifferencer.java8
-rw-r--r--bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java5
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java9
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java18
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContentViewerSwitchingPane.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java11
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java13
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java21
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java83
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java11
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java22
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java37
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java23
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java27
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java30
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java59
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java9
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java6
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java31
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java12
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java5
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java12
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java3
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java10
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java11
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java14
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java44
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/SWTUtils.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java48
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java32
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java59
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java21
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java28
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java46
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java36
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSet.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java33
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncByteConverter.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java17
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java29
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java65
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java23
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java13
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java47
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileStore.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileTree.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/LogEntryCache.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java21
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java86
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderSandbox.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java25
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java33
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java16
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantResourceVariantByteStore.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java13
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java21
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/PServerSSH2ServerConnection.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/WorkspaceResourceMapper.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CreatePatchAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java29
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PropertyChangeHandler.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PromptingDialog.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/DateHistoryCategory.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/OpenLocalFileAction.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/AbstractCompareInput.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java56
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/MultiLabelDecorator.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshChangeListener.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RegexDiffComparator.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSynchronizationActionProvider.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSynchronizationWizard.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/DiffProjectResourceMapping.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchModelProvider.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncContentProvider.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetOperation.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SaveableComparison.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeLabelProvider.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeScope.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipantActionGroup.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java17
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsComposite.java27
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsLabelProvider.java4
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyEntriesComposite.java22
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyEntriesLabelProvider.java4
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyEntryDialog.java4
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java23
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java8
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java22
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java8
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java13
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java3
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java3
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java13
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/localhistory/RevertAllOperation.java3
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java4
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java11
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java6
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java13
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java7
-rw-r--r--tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java12
-rw-r--r--tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java17
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeBuildingTests.java3
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/mapping/ScopeTests.java3
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/ResourceContentTests.java12
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CommandLineCVSClient.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseCVSClient.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java84
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/FindCommittersTest.java6
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/JUnitTestCase.java8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/SameResultEnv.java18
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java30
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java46
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java19
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSProjectSetImportTest.java17
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ParticipantSyncInfoSource.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java9
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/RepositoriesViewTests.java29
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java24
474 files changed, 2419 insertions, 3377 deletions
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
index ab64d83a3..02f765fb8 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
@@ -18,7 +18,6 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -102,8 +101,8 @@ public class FileDiffResult implements IFilePatchResult {
this.fBeforeLines = new ArrayList<>(getLines(content, false));
this.fAfterLines = this.fMatches ? new ArrayList<>() : this.fBeforeLines;
IHunk[] hunks = this.fDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- Hunk hunk = (Hunk) hunks[i];
+ for (IHunk h : hunks) {
+ Hunk hunk = (Hunk) h;
hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setMatches(false);
@@ -118,8 +117,8 @@ public class FileDiffResult implements IFilePatchResult {
// Check to see if we have at least one hunk that matches
this.fMatches = false;
IHunk[] hunks = this.fDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- Hunk hunk = (Hunk) hunks[i];
+ for (IHunk h : hunks) {
+ Hunk hunk = (Hunk) h;
HunkResult result = getHunkResult(hunk);
if (result.isOK()) {
this.fMatches = true;
@@ -161,8 +160,8 @@ public class FileDiffResult implements IFilePatchResult {
}
int shift= 0;
IHunk[] hunks = this.fDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- Hunk hunk = (Hunk) hunks[i];
+ for (IHunk h : hunks) {
+ Hunk hunk = (Hunk) h;
hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setShift(shift);
@@ -184,8 +183,7 @@ public class FileDiffResult implements IFilePatchResult {
public boolean containsProblems() {
if (this.fDiffProblem)
return true;
- for (Iterator<HunkResult> iterator = this.fHunkResults.values().iterator(); iterator.hasNext();) {
- HunkResult result = iterator.next();
+ for (HunkResult result : this.fHunkResults.values()) {
if (!result.isOK())
return true;
}
@@ -263,8 +261,8 @@ public class FileDiffResult implements IFilePatchResult {
public List<Hunk> getFailedHunks() {
List<Hunk> failedHunks = new ArrayList<>();
IHunk[] hunks = this.fDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- HunkResult result = this.fHunkResults.get(hunks[i]);
+ for (IHunk hunk : hunks) {
+ HunkResult result = this.fHunkResults.get(hunk);
if (result != null && !result.isOK())
failedHunks.add(result.getHunk());
}
@@ -287,8 +285,8 @@ public class FileDiffResult implements IFilePatchResult {
// return hunk results in the same order as hunks are placed in file diff
List<HunkResult> results = new ArrayList<>();
IHunk[] hunks = this.fDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- HunkResult result = this.fHunkResults.get(hunks[i]);
+ for (IHunk hunk : hunks) {
+ HunkResult result = this.fHunkResults.get(hunk);
if (result != null) {
results.add(result);
}
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java
index 4160b131f..b108f3cd3 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java
@@ -223,8 +223,7 @@ public class FilePatch2 implements IFilePatch2 {
adjustedNewPath = new Path(null, this.fProject.getName()).append(this.fNewPath);
}
FilePatch2 diff = create(adjustedOldPath, 0, adjustedNewPath, 0);
- for (Iterator<Hunk> iterator = this.fHunks.iterator(); iterator.hasNext();) {
- Hunk hunk = iterator.next();
+ for (Hunk hunk : this.fHunks) {
// Creating the hunk adds it to the parent diff
new Hunk(diff, hunk);
}
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
index 2256d28b7..3a4f3dae8 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
@@ -92,8 +92,7 @@ public class Hunk implements IHunk {
*/
public String getContent() {
StringBuilder sb= new StringBuilder();
- for (int i= 0; i < this.fLines.length; i++) {
- String line= this.fLines[i];
+ for (String line : this.fLines) {
sb.append(line.substring(0, LineReader.length(line)));
sb.append('\n');
}
@@ -183,8 +182,7 @@ public class Hunk implements IHunk {
List<String> contextLines = new ArrayList<>();
boolean contextLinesMatched = true;
boolean precedingLinesChecked = false;
- for (int i= 0; i < this.fLines.length; i++) {
- String s = this.fLines[i];
+ for (String s : this.fLines) {
Assert.isTrue(s.length() > 0);
String line = s.substring(1);
char controlChar = s.charAt(0);
@@ -332,25 +330,24 @@ public class Hunk implements IHunk {
boolean precedingLinesChecked = false;
String lineDelimiter = getLineDelimiter(lines);
- for (int i= 0; i < this.fLines.length; i++) {
- String s= this.fLines[i];
+ for (String s : this.fLines) {
Assert.isTrue(s.length() > 0);
String line= s.substring(1);
char controlChar= s.charAt(0);
if (controlChar == ' ') {
// context lines
- Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in context"); //$NON-NLS-1$
- contextLines.add(line);
- if (linesMatch(configuration, line, lines.get(pos))) {
- pos++;
- continue;
- } else if (fuzz > 0) {
- // doesn't match, use the fuzz factor
- contextLinesMatched = false;
- pos++;
- continue;
- }
- Assert.isTrue(false, "doPatch: context doesn't match"); //$NON-NLS-1$
+ Assert.isTrue(pos < lines.size(), "doPatch: inconsistency in context"); //$NON-NLS-1$
+ contextLines.add(line);
+ if (linesMatch(configuration, line, lines.get(pos))) {
+ pos++;
+ continue;
+ } else if (fuzz > 0) {
+ // doesn't match, use the fuzz factor
+ contextLinesMatched = false;
+ pos++;
+ continue;
+ }
+ Assert.isTrue(false, "doPatch: context doesn't match"); //$NON-NLS-1$
// pos++;
} else if (isDeletedDelimeter(controlChar, reverse)) {
// deleted lines
@@ -463,8 +460,7 @@ public class Hunk implements IHunk {
public String getContents(boolean isAfterState, boolean reverse) {
StringBuilder result= new StringBuilder();
- for (int i= 0; i<this.fLines.length; i++) {
- String line= this.fLines[i];
+ for (String line : this.fLines) {
String rest= line.substring(1);
char c = line.charAt(0);
if (c == ' ') {
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/HunkResult.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/HunkResult.java
index aeda0cc84..77a6849ff 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/HunkResult.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/HunkResult.java
@@ -254,8 +254,8 @@ public class HunkResult {
private boolean isEnabled(PatchConfiguration configuration) {
IHunkFilter[] filters = configuration.getHunkFilters();
- for (int i = 0; i < filters.length; i++) {
- if (!filters[i].select(this.fHunk)) {
+ for (IHunkFilter filter : filters) {
+ if (!filter.select(this.fHunk)) {
return false;
}
}
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
index 7bf46f7c5..4ebb67735 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
@@ -159,8 +159,7 @@ public class PatchReader {
private String readUnifiedDiff(List<FilePatch2> diffs, LineReader lr, String line, String diffArgs, String fileName, DiffProject diffProject) throws IOException {
List<FilePatch2> newDiffs= new ArrayList<>();
String nextLine= readUnifiedDiff(newDiffs, lr, line, diffArgs, fileName);
- for (Iterator<FilePatch2> iter= newDiffs.iterator(); iter.hasNext();) {
- FilePatch2 diff= iter.next();
+ for (FilePatch2 diff : newDiffs) {
diffProject.add(diff);
diffs.add(diff);
}
@@ -595,10 +594,10 @@ public class PatchReader {
private long extractDate(String[] args, int n) {
if (n < args.length) {
String line= args[n];
- for (int i= 0; i < this.fDateFormats.length; i++) {
- this.fDateFormats[i].setLenient(true);
+ for (DateFormat dateFormat : this.fDateFormats) {
+ dateFormat.setLenient(true);
try {
- Date date= this.fDateFormats[i].parse(line);
+ Date date = dateFormat.parse(line);
return date.getTime();
} catch (ParseException ex) {
// silently ignored
@@ -696,8 +695,7 @@ public class PatchReader {
if (!isWorkspacePatch() || this.fDiffs.length == 0)
return this.fDiffs;
List<FilePatch2> result = new ArrayList<>();
- for (int i = 0; i < this.fDiffs.length; i++) {
- FilePatch2 diff = this.fDiffs[i];
+ for (FilePatch2 diff : this.fDiffs) {
result.add(diff.asRelativeDiff());
}
return result.toArray(new FilePatch2[result.size()]);
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
index 4764ef408..2050d0d00 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
@@ -94,8 +94,8 @@ public class PatchBuilder {
IPath newPath, long newDate, IHunk[] hunks) {
reorder(hunks);
FilePatch2 fileDiff = new FilePatch2(oldPath, oldDate, newPath, newDate);
- for (int i = 0; i < hunks.length; i++) {
- fileDiff.add((Hunk) hunks[i]);
+ for (IHunk hunk : hunks) {
+ fileDiff.add((Hunk) hunk);
}
return fileDiff;
}
@@ -165,9 +165,9 @@ public class PatchBuilder {
private static int getHunkLength(String[] lines, boolean old) {
int length = 0;
- for (int i = 0; i < lines.length; i++) {
- if (lines[i].length() > 0) {
- switch (lines[i].charAt(0)) {
+ for (String line : lines) {
+ if (line.length() > 0) {
+ switch (line.charAt(0)) {
case ' ':
length++;
break;
@@ -190,9 +190,9 @@ public class PatchBuilder {
}
private static boolean checkForPrefix(char prefix, String[] lines) {
- for (int i = 0; i < lines.length; i++) {
- if (lines[i].length() > 0) {
- if (lines[i].charAt(0) == prefix) {
+ for (String line : lines) {
+ if (line.length() > 0) {
+ if (line.charAt(0) == prefix) {
return true;
}
}
@@ -210,8 +210,8 @@ public class PatchBuilder {
private static IHunk[] removeHunks(IHunk[] hunks, IHunk[] toRemove) {
int removed = 0;
for (int i = 0; i < hunks.length; i++) {
- for (int j = 0; j < toRemove.length; j++) {
- if (toRemove[j] == hunks[i]) {
+ for (IHunk r : toRemove) {
+ if (r == hunks[i]) {
hunks[i] = null;
removed++;
}
@@ -229,8 +229,8 @@ public class PatchBuilder {
private static void reorder(IHunk[] hunks) {
Arrays.sort(hunks, new HunkComparator());
int shift = 0;
- for (int i = 0; i < hunks.length; i++) {
- Hunk hunk = (Hunk) hunks[i];
+ for (IHunk h : hunks) {
+ Hunk hunk = (Hunk) h;
int start = hunk.getStart(false) + shift;
hunk.setStart(start, true);
shift += hunk.getLength(true) - hunk.getLength(false);
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer/RangeDifferencer.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
index fc88a0956..0035ef923 100644
--- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
+++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
@@ -294,9 +294,7 @@ public final class RangeDifferencer {
int mstart= 0;
int ystart= 0;
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
+ for (RangeDifference es : in) {
rd= factory.createRangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart);
if (rd.maxLength() != 0)
out.add(rd);
@@ -375,9 +373,7 @@ public final class RangeDifferencer {
int ystart= 0;
int astart= 0;
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
+ for (RangeDifference es : in) {
rd= factory.createRangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart);
if (rd.maxLength() > 0)
out.add(rd);
diff --git a/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java b/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java
index 9fd5fba76..1ad9cbd9c 100644
--- a/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java
+++ b/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java
@@ -438,8 +438,8 @@ public class WordMergeViewer extends AbstractMergeViewer implements IFlushable,
private void firePropertyChange(String property, Object oldValue, Object newValue) {
Object[] allListeners = listeners.getListeners();
final PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue);
- for (int i = 0; i < allListeners.length; i++) {
- final IPropertyChangeListener listener = (IPropertyChangeListener)allListeners[i];
+ for (Object allListener : allListeners) {
+ final IPropertyChangeListener listener = (IPropertyChangeListener) allListener;
SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
listener.propertyChange(event);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
index 82580fadd..b6a1a0c43 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareConfiguration.java
@@ -17,7 +17,6 @@ package org.eclipse.compare;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -254,8 +253,7 @@ public class CompareConfiguration {
@Override
public void dispose() {
- for (Iterator<ICompareInputLabelProvider> iterator = labelProviders.values().iterator(); iterator.hasNext();) {
- ICompareInputLabelProvider lp = iterator.next();
+ for (ICompareInputLabelProvider lp : labelProviders.values()) {
lp.removeListener(this);
}
if (defaultLabelProvider != null)
@@ -413,8 +411,8 @@ public class CompareConfiguration {
PropertyChangeEvent event= null;
Object[] listeners= fListeners.getListeners();
if (listeners != null) {
- for (int i= 0; i < listeners.length; i++) {
- IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
+ for (Object listener : listeners) {
+ IPropertyChangeListener l = (IPropertyChangeListener) listener;
if (event == null)
event= new PropertyChangeEvent(this, propertyName, oldValue, newValue);
l.propertyChange(event);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
index 8b41e3510..1adba9f70 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
@@ -308,8 +308,9 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
@Override
public void open(OpenEvent event) {
Object[] listeners= fOpenListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IOpenListener) listeners[i]).open(event);
+ for (Object listener : listeners) {
+ ((IOpenListener) listener).open(event);
+ }
}
@Override
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index d1a76be5b..2a8c0e553 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -466,8 +466,9 @@ public class EditionSelectionDialog extends ResizableDialog {
if (sco != null) {
Object[] children= sco.getChildren();
if (children != null)
- for (int i= 0; i < children.length; i++)
- current.add(children[i]);
+ for (Object child : children) {
+ current.add(child);
+ }
}
final IStructureCreator sc= structureCreator;
@@ -489,8 +490,8 @@ public class EditionSelectionDialog extends ResizableDialog {
if (sco2 != null) {
Object[] children= sco2.getChildren();
if (children != null) {
- for (int i2= 0; i2 < children.length; i2++) {
- ITypedElement child= (ITypedElement) children[i2];
+ for (Object c : children) {
+ ITypedElement child = (ITypedElement) c;
if (!current.contains(child))
sendPair(new Pair(sc, edition, child));
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
index 1b3ff0866..e16b03d70 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
@@ -135,8 +135,8 @@ public class ResourceNode extends BufferedContent
if (fResource instanceof IContainer) {
try {
IResource members[]= ((IContainer)fResource).members();
- for (int i= 0; i < members.length; i++) {
- IStructureComparator child= createChild(members[i]);
+ for (IResource member : members) {
+ IStructureComparator child = createChild(member);
if (child != null)
fChildren.add(child);
}
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
index db23be7a3..a856d1d7f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -1398,9 +1398,9 @@ public abstract class ContentMergeViewer extends ContentViewer
}
if (source != null) {
Saveable[] saveables = source.getSaveables();
- for (int i = 0; i < saveables.length; i++) {
- if (saveables[i] instanceof ISavingSaveable) {
- ISavingSaveable saveable = (ISavingSaveable) saveables[i];
+ for (Saveable s : saveables) {
+ if (s instanceof ISavingSaveable) {
+ ISavingSaveable saveable = (ISavingSaveable) s;
if (saveable.isSaving())
return true;
}
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
index 7c6f260f8..48d802d7c 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -1284,8 +1284,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return;
IRegion region= textPresentation.getExtent();
Diff[] changeDiffs = fMerger.getChangeDiffs(getLeg(viewer), region);
- for (int i = 0; i < changeDiffs.length; i++) {
- Diff diff = changeDiffs[i];
+ for (Diff diff : changeDiffs) {
StyleRange range = getStyleRange(diff, region);
if (range != null)
textPresentation.mergeStyleRange(range);
@@ -3052,9 +3051,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private boolean isCursorLinePainterInstalled(SourceViewer viewer) {
Listener[] listeners = viewer.getTextWidget().getListeners(3001/*StyledText.LineGetBackground*/);
- for (int i = 0; i < listeners.length; i++) {
- if (listeners[i] instanceof TypedListener) {
- TypedListener listener = (TypedListener) listeners[i];
+ for (Listener l : listeners) {
+ if (l instanceof TypedListener) {
+ TypedListener listener = (TypedListener) l;
if (listener.getEventListener() instanceof CursorLinePainter)
return true;
}
@@ -3894,10 +3893,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
currentFiltersMatch = true;
@SuppressWarnings("unchecked")
List<ChangeCompareFilterPropertyAction> currentFilterActions = (List<ChangeCompareFilterPropertyAction>) current;
- for (int i = 0; i < compareFilterDescriptors.length; i++) {
+ for (CompareFilterDescriptor compareFilterDescriptor : compareFilterDescriptors) {
boolean match = false;
for (int j = 0; j < currentFilterActions.size(); j++) {
- if (compareFilterDescriptors[i].getFilterId().equals(currentFilterActions.get(j).getFilterId())) {
+ if (compareFilterDescriptor.getFilterId().equals(currentFilterActions.get(j).getFilterId())) {
match = true;
break;
}
@@ -3913,9 +3912,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Boolean.TRUE);
disposeCompareFilterActions(true);
fCompareFilterActions.clear();
- for (int i = 0; i < compareFilterDescriptors.length; i++) {
- ChangeCompareFilterPropertyAction compareFilterAction = new ChangeCompareFilterPropertyAction(
- compareFilterDescriptors[i], getCompareConfiguration());
+ for (CompareFilterDescriptor compareFilterDescriptor : compareFilterDescriptors) {
+ ChangeCompareFilterPropertyAction compareFilterAction = new ChangeCompareFilterPropertyAction(compareFilterDescriptor, getCompareConfiguration());
compareFilterAction.setInput(input, ancestor, left, right);
fCompareFilterActions.add(compareFilterAction);
fLeft.addTextAction(compareFilterAction);
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
index 09e78479d..911e235a0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
@@ -55,8 +55,7 @@ public class AddFromHistoryAction extends BaseCompareAction {
Object[] s= Utilities.getResources(selection);
- for (int i= 0; i < s.length; i++) {
- Object o= s[i];
+ for (Object o : s) {
if (o instanceof IContainer) {
IContainer container= (IContainer) o;
@@ -128,11 +127,10 @@ public class AddFromHistoryAction extends BaseCompareAction {
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;
+ for (AddFromHistoryDialog.HistoryInput s : selected) {
+ IFile file = s.fFile;
+ IFileState fileState = s.fFileState;
createContainers(file);
-
SubMonitor subMonitor= SubMonitor.convert(pm, 1);
try {
file.create(fileState.getContents(), false, subMonitor);
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
index ffeedc5c1..758bffe13 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
@@ -197,8 +197,7 @@ public class AddFromHistoryDialog extends ResizableDialog {
String prefix= root.getFullPath().toString();
if (fMemberTable != null && !fMemberTable.isDisposed()) {
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
String path = file.getFullPath().toString();
// ignore a recently deleted file at the same path as the
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContentViewerSwitchingPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContentViewerSwitchingPane.java
index 4b1fea214..3026cc907 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContentViewerSwitchingPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContentViewerSwitchingPane.java
@@ -221,8 +221,7 @@ public class CompareContentViewerSwitchingPane extends CompareViewerSwitchingPan
new MenuItem(menu, SWT.SEPARATOR);
// Add others
- for (int i = 0; i < vd.length; i++) {
- final ViewerDescriptor vdi = vd[i];
+ for (ViewerDescriptor vdi : vd) {
label = vdi.getLabel();
if (label == null || label.isEmpty()) {
String l = CompareUIPlugin.getDefault().findContentTypeNameOrType((ICompareInput) getInput(),
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
index 2d5d8c9f8..735ce130a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -566,8 +566,7 @@ public class CompareEditor extends EditorPart
if (init || knownSaveables == null) {
recordSaveables(sourceSaveables);
} else {
- for (int i = 0; i < sourceSaveables.length; i++) {
- Saveable saveable = sourceSaveables[i];
+ for (Saveable saveable : sourceSaveables) {
if (!knownSaveables.contains(saveable)) {
CompareUIPlugin.logErrorMessage(NLS.bind("Saveable {0} was not added using a saveables lifecycle event.", saveable.getName())); //$NON-NLS-1$
knownSaveables.add(saveable);
@@ -591,8 +590,7 @@ public class CompareEditor extends EditorPart
if (sourceSaveables.length != knownSaveables.size()) {
return false;
}
- for (int i = 0; i < sourceSaveables.length; i++) {
- Saveable saveable = sourceSaveables[i];
+ for (Saveable saveable : sourceSaveables) {
if (!knownSaveables.contains(saveable)) {
return false;
}
@@ -717,11 +715,10 @@ public class CompareEditor extends EditorPart
return;
java.util.List<Saveable> result = new ArrayList<>();
Saveable[] all = event.getSaveables();
- for (int i = 0; i < all.length; i++) {
- Saveable saveable = all[i];
+ for (Saveable saveable : all) {
if (knownSaveables.contains(saveable))
result.add(saveable);
- knownSaveables.remove(saveable);
+ knownSaveables.remove(saveable);
}
if (result.isEmpty())
return;
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
index 437189e75..1d54e91c2 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
@@ -124,21 +124,20 @@ public class CompareEditorContributor extends EditorActionBarContributor {
IContributionItem[] items = actionBars.getToolBarManager()
.getItems();
boolean inFilters = false;
- for (int i = 0; i < items.length; i++) {
- if (items[i].getId().equals(FILTER_SEPARATOR)) {
+ for (IContributionItem item : items) {
+ if (item.getId().equals(FILTER_SEPARATOR)) {
inFilters = true;
- } else if (items[i].getId().equals(BUILTIN_SEPARATOR)) {
+ } else if (item.getId().equals(BUILTIN_SEPARATOR)) {
break;
} else if (inFilters) {
- if (items[i] instanceof ActionContributionItem) {
- String definitionId = ((ActionContributionItem) items[i])
- .getAction().getActionDefinitionId();
+ if (item instanceof ActionContributionItem) {
+ String definitionId = ((ActionContributionItem) item).getAction().getActionDefinitionId();
if (definitionId != null) {
actionBars.setGlobalActionHandler(definitionId,
null);
}
}
- actionBars.getToolBarManager().remove(items[i]);
+ actionBars.getToolBarManager().remove(item);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
index c991b43d5..7773135c2 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
@@ -53,8 +53,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
protected INavigatable[] getNavigatables() {
List<INavigatable> result = new ArrayList<>();
Object[] panes = getPanes();
- for (int i = 0; i < panes.length; i++) {
- Object pane = panes[i];
+ for (Object pane : panes) {
INavigatable navigator= getNavigator(pane);
if (navigator != null)
result.add(navigator);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
index ea1004aa7..005cb0ae0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
@@ -88,8 +88,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
InternalListener listener= new InternalListener();
fViewerInFocus= viewerInFocus;
- for (int i= 0; i < fViewers.length; i++) {
- TextViewer viewer= fViewers[i];
+ for (TextViewer viewer : fViewers) {
viewer.addSelectionChangedListener(listener);
viewer.addPostSelectionChangedListener(new InternalPostSelectionListener());
StyledText textWidget = viewer.getTextWidget();
@@ -98,9 +97,9 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
}
private void doFocusChanged(Widget control) {
- for (int i= 0; i < fViewers.length; i++) {
- if (fViewers[i].getTextWidget() == control) {
- propagateFocusChanged(fViewers[i]);
+ for (TextViewer viewer : fViewers) {
+ if (viewer.getTextWidget() == control) {
+ propagateFocusChanged(viewer);
return;
}
}
@@ -198,8 +197,9 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
if (fViewers == null)
return;
- for (int i= 0; i < fViewers.length; i++)
- fViewers[i].setVisibleRegion(0, fViewers[i].getDocument().getLength());
+ for (TextViewer viewer : fViewers) {
+ viewer.setVisibleRegion(0, viewer.getDocument().getLength());
+ }
}
/**
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
index 0441fba9e..94613e2f1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
@@ -55,8 +55,8 @@ public class CompareResourceFilter {
public static String validateResourceFilters(String text) {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
String[] filters= getTokens(text, ","); //$NON-NLS-1$
- for (int i= 0; i < filters.length; i++) {
- String fileName= filters[i].replace('*', 'x');
+ for (String filter : filters) {
+ String fileName = filter.replace('*', 'x');
int resourceType= IResource.FILE;
int lastCharacter= fileName.length() - 1;
if (lastCharacter >= 0 && fileName.charAt(lastCharacter) == '/') {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
index 844e772ba..1593d8577 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
@@ -171,8 +171,7 @@ public class CompareStructureViewerSwitchingPane extends
new MenuItem(menu, SWT.SEPARATOR);
// add others
- for (int i = 0; i < vd.length; i++) {
- final ViewerDescriptor vdi = vd[i];
+ for (ViewerDescriptor vdi : vd) {
label = vdi.getLabel();
if (label == null || label.equals("")) { //$NON-NLS-1$
String l = CompareUIPlugin.getDefault().findStructureTypeNameOrType((ICompareInput) getInput(), vdi, getCompareConfiguration());
@@ -227,9 +226,9 @@ public class CompareStructureViewerSwitchingPane extends
public void setText(String label) {
Composite c = (Composite) getTopLeft();
Control[] children = c.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof CLabel) {
- CLabel cl = (CLabel) children[i];
+ for (Control child : children) {
+ if (child instanceof CLabel) {
+ CLabel cl = (CLabel) child;
if (cl != null && !cl.isDisposed()) {
cl.setText(label);
c.layout();
@@ -243,9 +242,9 @@ public class CompareStructureViewerSwitchingPane extends
public void setImage(Image image) {
Composite c = (Composite) getTopLeft();
Control[] children = c.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof CLabel) {
- CLabel cl = (CLabel) children[i];
+ for (Control child : children) {
+ if (child instanceof CLabel) {
+ CLabel cl = (CLabel) child;
if (cl != null && !cl.isDisposed())
cl.setImage(image);
return;
@@ -257,9 +256,9 @@ public class CompareStructureViewerSwitchingPane extends
public void addMouseListener(MouseListener listener) {
Composite c = (Composite) getTopLeft();
Control[] children = c.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof CLabel) {
- CLabel cl = (CLabel) children[i];
+ for (Control child : children) {
+ if (child instanceof CLabel) {
+ CLabel cl = (CLabel) child;
cl.addMouseListener(listener);
}
}
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
index 45f71276b..a26bfe772 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
@@ -361,21 +361,18 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// collect all IStreamMergers
IConfigurationElement[] elements= registry.getConfigurationElementsFor(PLUGIN_ID, STREAM_MERGER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (STREAM_MERGER.equals(element.getName()))
+ for (IConfigurationElement element : elements) {
+ if (STREAM_MERGER.equals(element.getName()))
fStreamMergers.register(element, new StreamMergerDescriptor(element));
}
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (CONTENT_TYPE_BINDING.equals(element.getName()))
- fStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
+ for (IConfigurationElement element : elements) {
+ if (CONTENT_TYPE_BINDING.equals(element.getName()))
+ fStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
}
// collect all IStructureCreators
elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_CREATOR_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!STRUCTURE_CREATOR.equals(name))
@@ -383,16 +380,14 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fStructureCreators.register(element, new StructureCreatorDescriptor(element));
}
}
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (CONTENT_TYPE_BINDING.equals(element.getName()))
fStructureCreators.createBinding(element, STRUCTURE_CREATOR_ID_ATTRIBUTE);
}
// collect all viewers which define the structure merge viewer extension point
elements= registry.getConfigurationElementsFor(PLUGIN_ID, STRUCTURE_MERGE_VIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name))
@@ -400,16 +395,14 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fStructureMergeViewers.register(element, new ViewerDescriptor(element));
}
}
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (CONTENT_TYPE_BINDING.equals(element.getName()))
fStructureMergeViewers.createBinding(element, STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE);
}
// collect all viewers which define the content merge viewer extension point
elements= registry.getConfigurationElementsFor(PLUGIN_ID, CONTENT_MERGE_VIEWER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name))
@@ -417,8 +410,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fContentMergeViewers.register(element, new ViewerDescriptor(element));
}
}
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (CONTENT_TYPE_BINDING.equals(element.getName()))
fContentMergeViewers.createBinding(element, CONTENT_MERGE_VIEWER_ID_ATTRIBUTE);
}
@@ -426,8 +418,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// collect all extensions that define the compare filter extension point
elements = registry.getConfigurationElementsFor(PLUGIN_ID,
COMPARE_FILTER_EXTENTION_POINT);
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String name = element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!FILTER_TAG.equals(name))
@@ -436,8 +427,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fCompareFilters.register(element, new CompareFilterDescriptor(element));
}
}
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
if (CONTENT_TYPE_BINDING.equals(element.getName()))
fCompareFilters.createBinding(element,
COMPARE_FILTER_ID_ATTRIBUTE);
@@ -445,8 +435,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// 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++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name))
@@ -454,8 +443,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fContentViewers.register(element, new ViewerDescriptor(element));
}
}
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (CONTENT_TYPE_BINDING.equals(element.getName()))
fContentViewers.createBinding(element, CONTENT_VIEWER_ID_ATTRIBUTE);
}
@@ -958,12 +946,14 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
if (type == null) {
int n = 0;
- for (int i = 0; i < types.length; i++)
- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) {
+ for (String t : types) {
+ if (!ITypedElement.UNKNOWN_TYPE.equals(t)) {
n++;
- if (type == null)
- type = types[i]; // remember the first known type
+ if (type == null) {
+ type = t; // remember the first known type
+ }
}
+ }
if (n > 1) // don't use the type if there were more than one
type = null;
}
@@ -1043,12 +1033,14 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
if (type == null) {
int n= 0;
- for (int i= 0; i < types.length; i++)
- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) {
+ for (String t : types) {
+ if (!ITypedElement.UNKNOWN_TYPE.equals(t)) {
n++;
- if (type == null)
- type= types[i]; // remember the first known type
+ if (type == null) {
+ type = t; // remember the first known type
+ }
}
+ }
if (n > 1) // don't use the type if there were more than one
type= null;
}
@@ -1425,12 +1417,11 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
List<IEditorPart> result= new ArrayList<IEditorPart>(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];
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage[] pages = window.getPages();
+ for (IWorkbenchPage page : pages) {
+ IEditorPart[] editors = page.getDirtyEditors();
+ for (IEditorPart ep : editors) {
IEditorInput input= ep.getEditorInput();
if (!inputs.contains(input)) {
inputs.add(input);
@@ -1476,12 +1467,14 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
if (type == null) {
int n= 0;
- for (int i= 0; i < types.length; i++)
- if (!ITypedElement.UNKNOWN_TYPE.equals(types[i])) {
+ for (String t : types) {
+ if (!ITypedElement.UNKNOWN_TYPE.equals(t)) {
n++;
- if (type == null)
- type= types[i]; // remember the first known type
+ if (type == null) {
+ type = t; // remember the first known type
+ }
}
+ }
if (n > 1) // don't use the type if there were more than one
type= null;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
index 129132457..805c090f5 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
@@ -403,8 +403,8 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
private void addListenersToRadioButtons() {
final ContentTypeElement[] elements = new ContentTypeElement[] { workspaceContent,
externalFileContent, externalFolderContent };
- for (int i = 0; i < elements.length; i++) {
- elements[i].getRadioButton().addListener(SWT.Selection, event -> {
+ for (ContentTypeElement e : elements) {
+ e.getRadioButton().addListener(SWT.Selection, event -> {
for (ContentTypeElement element : elements) {
if (event.widget != element.getRadioButton())
element.setEnabled(false);
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
index 5eb99ee55..d1ce02c0b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
@@ -84,8 +84,8 @@ public class DocLineComparator implements ITokenComparator {
boolean cacheFilteredLines = false;
if (compareFilters != null && compareFilters.length > 0) {
cacheFilteredLines = true;
- for (int i = 0; i < compareFilters.length; i++) {
- if (!compareFilters[i].canCacheFilteredRegions()) {
+ for (ICompareFilter compareFilter : compareFilters) {
+ if (!compareFilter.canCacheFilteredRegions()) {
cacheFilteredLines = false;
break;
}
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
index f974e5a2c..0bbfb7251 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
@@ -106,8 +106,9 @@ public class EditionAction extends BaseCompareAction {
@Override
protected void run(ISelection selection) {
IFile[] files= Utilities.getFiles(selection);
- for (int i= 0; i < files.length; i++)
- doFromHistory(files[i]);
+ for (IFile file : files) {
+ doFromHistory(file);
+ }
}
private void doFromHistory(final IFile file) {
@@ -228,12 +229,10 @@ public class EditionAction extends BaseCompareAction {
FileEditorInput test= new FileEditorInput(file);
- for (int i= 0; i < ws.length; i++) {
- IWorkbenchWindow w= ws[i];
+ for (IWorkbenchWindow w : ws) {
IWorkbenchPage[] wps= w.getPages();
if (wps != null) {
- for (int j= 0; j < wps.length; j++) {
- IWorkbenchPage wp= wps[j];
+ for (IWorkbenchPage wp : wps) {
IEditorPart ep= wp.findEditor(test);
if (ep instanceof ITextEditor) {
ITextEditor te= (ITextEditor) ep;
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
index 3b1a25c09..6159844c1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
@@ -73,9 +73,10 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
private OverlayKey findOverlayKey(String key) {
- for (int i= 0; i < fOverlayKeys.length; i++) {
- if (fOverlayKeys[i].fKey.equals(key))
- return fOverlayKeys[i];
+ for (OverlayKey overlayKey : fOverlayKeys) {
+ if (overlayKey.fKey.equals(key)) {
+ return overlayKey;
+ }
}
return null;
}
@@ -139,8 +140,9 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
public void propagate() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
+ for (OverlayKey overlayKey : fOverlayKeys) {
+ propagateProperty(fStore, overlayKey, fParent);
+ }
}
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
@@ -191,13 +193,15 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
public void load() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- loadProperty(fParent, fOverlayKeys[i], fStore, true);
+ for (OverlayKey overlayKey : fOverlayKeys) {
+ loadProperty(fParent, overlayKey, fStore, true);
+ }
}
public void loadDefaults() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
+ for (OverlayKey overlayKey : fOverlayKeys) {
+ setToDefault(overlayKey.fKey);
+ }
}
public void start() {
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
index 374523a14..94450efdf 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -292,9 +292,11 @@ class ResourceCompareInput extends CompareEditorInput {
}
private boolean checkSelection(IResource[] resources) {
- for (int i = 0; i < resources.length; i++)
- if (resources[i] == null)
+ for (IResource resource : resources) {
+ if (resource == null) {
return false;
+ }
+ }
return true;
}
@@ -492,8 +494,7 @@ class ResourceCompareInput extends CompareEditorInput {
IDiffElement[] children= node.getChildren();
if (children != null) {
- for (int i= 0; i < children.length; i++) {
- IDiffElement element= children[i];
+ for (IDiffElement element : children) {
if (element instanceof DiffNode)
commit(pm, (DiffNode) element);
}
@@ -546,8 +547,7 @@ class ResourceCompareInput extends CompareEditorInput {
IDiffElement[] children= node.getChildren();
if (children != null) {
- for (int i= 0; i < children.length; i++) {
- IDiffElement element= children[i];
+ for (IDiffElement element : children) {
if (element instanceof DiffNode)
collectDirtyResources(element, collector);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
index 998d4d18a..b2c66ecc0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
@@ -14,7 +14,6 @@
package org.eclipse.compare.internal;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -148,8 +147,7 @@ public class ShowWhitespaceAction extends TextEditorPropertyAction {
private void hideWhitespace() {
Map<MergeSourceViewer, WhitespaceCharacterPainter> painters = getPainters();
- for (Iterator<MergeSourceViewer> iterator = painters.keySet().iterator(); iterator.hasNext();) {
- MergeSourceViewer viewer = iterator.next();
+ for (MergeSourceViewer viewer : painters.keySet()) {
WhitespaceCharacterPainter painter = painters.get(viewer);
if (painter != null) {
viewer.getSourceViewer().removePainter(painter);
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
index 6493d3313..66dbc68c4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
@@ -51,8 +51,8 @@ public class TabFolderLayout extends Layout {
Rectangle rect= composite.getClientArea();
Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
+ for (Control c : children) {
+ c.setBounds(rect);
}
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
index ee4947e41..055a7faf4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
@@ -38,8 +38,7 @@ public class TextEditorPropertyAction extends Action implements IPropertyChangeL
}
private void addActionToViewers() {
- for (int i = 0; i < viewers.length; i++) {
- MergeSourceViewer viewer = viewers[i];
+ for (MergeSourceViewer viewer : viewers) {
viewer.addTextAction(this);
}
}
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
index 16dce1327..113ae4bdb 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -127,8 +127,9 @@ public class Utilities {
public static void setEnableComposite(Composite composite, boolean enable) {
Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++)
- children[i].setEnabled(enable);
+ for (Control c : children) {
+ c.setEnabled(enable);
+ }
}
public static boolean getBoolean(CompareConfiguration cc, String key, boolean dflt) {
@@ -188,20 +189,20 @@ public class Utilities {
if (selection instanceof IStructuredSelection) {
Object[] s= ((IStructuredSelection) selection).toArray();
- for (int i= 0; i < s.length; i++) {
+ for (Object o : s) {
IResource resource= null;
- Object o= s[i];
if (type.isInstance(o)) {
resource= (IResource) o;
} else if (o instanceof ResourceMapping) {
try {
ResourceTraversal[] travs= ((ResourceMapping)o).getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
if (travs != null) {
- for (int k= 0; k < travs.length; k++) {
- IResource[] resources= travs[k].getResources();
- for (int j= 0; j < resources.length; j++) {
- if (type.isInstance(resources[j]) && resources[j].isAccessible())
- tmp.add(resources[j]);
+ for (ResourceTraversal trav : travs) {
+ IResource[] resources = trav.getResources();
+ for (IResource r : resources) {
+ if (type.isInstance(r) && r.isAccessible()) {
+ tmp.add(r);
+ }
}
}
}
@@ -809,10 +810,10 @@ public class Utilities {
*/
public static boolean setReadTimeout(URLConnection connection, int timeout) {
Method[] methods = connection.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals("setReadTimeout")) { //$NON-NLS-1$
+ for (Method method : methods) {
+ if (method.getName().equals("setReadTimeout")) { //$NON-NLS-1$
try {
- methods[i].invoke(connection, new Object[] {Integer.valueOf(timeout)});
+ method.invoke(connection, new Object[] {Integer.valueOf(timeout)});
return true;
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
// ignore
@@ -891,12 +892,12 @@ public class Utilities {
}
boolean[] ignored = new boolean[thisLine.length()];
- for (int j = 0; j < ignoredRegions.length; j++) {
- if (ignoredRegions[j] != null) {
- for (int k = 0; k < ignoredRegions[j].length; k++) {
- if (ignoredRegions[j][k] != null) {
- for (int l = 0; l < ignoredRegions[j][k].getLength(); l++) {
- ignored[ignoredRegions[j][k].getOffset() + l] = true;
+ for (IRegion[] regions : ignoredRegions) {
+ if (regions != null) {
+ for (IRegion region : regions) {
+ if (region != null) {
+ for (int l = 0; l < region.getLength(); l++) {
+ ignored[region.getOffset() + l] = true;
}
}
}
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
index a96aa66cd..1d9320ed2 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
@@ -58,8 +58,8 @@ public class ViewerDescriptor implements IViewerDescriptor {
if (currentViewer != null) {
CompareHandlerService[] compareHandlerService = Adapters.adapt(currentViewer, CompareHandlerService[].class);
if (compareHandlerService != null) {
- for (int i = 0; i < compareHandlerService.length; i++) {
- compareHandlerService[i].dispose();
+ for (CompareHandlerService s : compareHandlerService) {
+ s.dispose();
}
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
index 52579620e..ac35a0c7a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
@@ -48,8 +48,7 @@ public class WorkerJob extends Job {
if (errors.length == 1)
return new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, errors[0].getMessage(), errors[0]);
List<IStatus> statii = new ArrayList<>();
- for (int i = 0; i < errors.length; i++) {
- Throwable throwable = errors[i];
+ for (Throwable throwable : errors) {
statii.add(new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, errors[0].getMessage(), throwable));
}
return new MultiStatus(CompareUIPlugin.PLUGIN_ID, 0, statii.toArray(new IStatus[statii.size()]), CompareMessages.WorkerJob_0, null);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
index faa11e67a..e34d14653 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
@@ -302,8 +302,7 @@ public class DocumentMerger {
public Diff[] getChangeDiffs(int contributor, IRegion region) {
if (fDiffs != null && intersectsRegion(contributor, region)) {
List<Diff> result = new ArrayList<>();
- for (Iterator<Diff> iterator = fDiffs.iterator(); iterator.hasNext();) {
- Diff diff = iterator.next();
+ for (Diff diff : fDiffs) {
if (diff.intersectsRegion(contributor, region)) {
result.add(diff);
}
@@ -450,9 +449,7 @@ public class DocumentMerger {
Boolean.FALSE);
ArrayList<Diff> newAllDiffs = new ArrayList<>();
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
-
+ for (RangeDifference es : e) {
int ancestorStart= 0;
int ancestorEnd= 0;
if (sancestor != null) {
@@ -589,9 +586,7 @@ public class DocumentMerger {
}
if (e != null) {
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
-
+ for (RangeDifference es : e) {
int kind= es.kind();
int ancestorStart= 0;
@@ -864,8 +859,7 @@ public class DocumentMerger {
ITokenComparator sy= createTokenComparator(s);
RangeDifference[] e= RangeDifferencer.findRanges(sa, sy, sm);
- for (int i= 0; i < e.length; i++) {
- RangeDifference es= e[i];
+ for (RangeDifference es : e) {
int kind= es.kind();
if (kind != RangeDifference.NOCHANGE) {
@@ -977,8 +971,7 @@ public class DocumentMerger {
}
public Diff findDiff(Position p, boolean left) {
- for (Iterator<Diff> iterator = fAllDiffs.iterator(); iterator.hasNext();) {
- Diff diff = iterator.next();
+ for (Diff diff : fAllDiffs) {
Position diffPos;
if (left) {
diffPos = diff.fLeftPos;
@@ -1127,11 +1120,9 @@ public class DocumentMerger {
if (fChangeDiffs == null)
return new Diff[0];
List<Diff> intersectingDiffs = new ArrayList<>();
- for (Iterator<Diff> iterator = fChangeDiffs.iterator(); iterator.hasNext();) {
- Diff diff = iterator.next();
+ for (Diff diff : fChangeDiffs) {
Diff[] changeDiffs = diff.getChangeDiffs(contributor, region);
- for (int i = 0; i < changeDiffs.length; i++) {
- Diff changeDiff = changeDiffs[i];
+ for (Diff changeDiff : changeDiffs) {
intersectingDiffs.add(changeDiff);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
index f9a0d9b7f..f002e1212 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
@@ -53,8 +53,7 @@ public class TextStreamMerger implements IStreamMerger {
RangeDifference[] diffs= RangeDifferencer.findRanges(monitor, a, t, o);
- for (int i= 0; i < diffs.length; i++) {
- RangeDifference rd= diffs[i];
+ for (RangeDifference rd : diffs) {
switch (rd.kind()) {
case RangeDifference.ANCESTOR: // pseudo conflict
case RangeDifference.NOCHANGE:
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
index 20db8e922..a17082675 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
@@ -99,9 +99,9 @@ class DecoratorOverlayIcon extends CompositeImageDescriptor {
@Override
public int hashCode() {
int code = base.hashCode();
- for (int i = 0; i < overlays.length; i++) {
- if (overlays[i] != null) {
- code ^= overlays[i].hashCode();
+ for (ImageDescriptor overlay : overlays) {
+ if (overlay != null) {
+ code ^= overlay.hashCode();
}
}
return code;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
index bc00a4f5c..c172454ef 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
@@ -86,8 +86,7 @@ public class HunkDiffNode extends PatchDiffNode {
if (fuzz > 0) {
String[] lines = result.getHunk().getLines();
int contextLines = 0;
- for (int i = 0; i < lines.length; i++) {
- String line = lines[i];
+ for (String line : lines) {
char c = line.charAt(0);
if (c == ' ') {
contextLines++;
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
index 1a6a6f53e..0453443ff 100644
--- 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
@@ -727,9 +727,11 @@ public class InputPatchPage extends WizardPage {
// 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]);
+ for (String sourceName : sourceNames) {
+ if (sourceName != null && sourceName.length() > 0) {
+ fPatchFileNameField.add(sourceName);
+ }
+ }
// set patch file path
String patchFilePath= settings.get(STORE_PATCH_FILES_ID);
@@ -739,9 +741,11 @@ public class InputPatchPage extends WizardPage {
// set URLs history
String[] sourceURLs= settings.getArray(STORE_PATCH_URLS_ID);
if (sourceURLs != null)
- for (int i= 0; i < sourceURLs.length; i++)
- if (sourceURLs[i] != null && sourceURLs[i].length() > 0)
- fPatchURLField.add(sourceURLs[i]);
+ for (String sourceURL : sourceURLs) {
+ if (sourceURL != null && sourceURL.length() > 0) {
+ fPatchURLField.add(sourceURL);
+ }
+ }
// If the previous apply patch was used with a clipboard, we need to check
// if there is a valid patch on the clipboard. This will be done in adjustToCurrentTarget()
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
index f09d0ec26..91a54aa5b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
@@ -243,18 +243,17 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
}
private void processDiffs(FilePatch2[] diffs) {
- for (int i = 0; i < diffs.length; i++) {
- processDiff(diffs[i], getRoot());
+ for (FilePatch2 diff : diffs) {
+ processDiff(diff, getRoot());
}
}
private void processProjects(DiffProject[] diffProjects) {
//create diffProject nodes
- for (int i = 0; i < diffProjects.length; i++) {
- PatchProjectDiffNode projectNode = new PatchProjectDiffNode(getRoot(), diffProjects[i], getPatcher().getConfiguration());
- FilePatch2[] diffs = diffProjects[i].getFileDiffs();
- for (int j = 0; j < diffs.length; j++) {
- FilePatch2 fileDiff = diffs[j];
+ for (DiffProject diffProject : diffProjects) {
+ PatchProjectDiffNode projectNode = new PatchProjectDiffNode(getRoot(), diffProject, getPatcher().getConfiguration());
+ FilePatch2[] diffs = diffProject.getFileDiffs();
+ for (FilePatch2 fileDiff : diffs) {
processDiff(fileDiff, projectNode);
}
}
@@ -264,8 +263,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
FileDiffResult diffResult = getPatcher().getDiffResult(diff);
PatchFileDiffNode node = PatchFileDiffNode.createDiffNode(parent, diffResult);
HunkResult[] hunkResults = diffResult.getHunkResults();
- for (int i = 0; i < hunkResults.length; i++) {
- HunkResult hunkResult = hunkResults[i];
+ for (HunkResult hunkResult : hunkResults) {
if (!hunkResult.isOK()) {
HunkDiffNode hunkNode = HunkDiffNode.createDiffNode(node, hunkResult, true);
Object left = hunkNode.getLeft();
@@ -350,9 +348,8 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
tbm.removeAll();
tbm.add(new Separator("contributed")); //$NON-NLS-1$
-
- for (int i = 0; i < actions.length; i++) {
- tbm.appendToGroup("contributed", actions[i]); //$NON-NLS-1$
+ for (Action action : actions) {
+ tbm.appendToGroup("contributed", action); //$NON-NLS-1$
}
tbm.update(true);
@@ -369,8 +366,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
public void resetRoot() {
IDiffElement[] children = root.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement child = children[i];
+ for (IDiffElement child : children) {
root.remove(child);
}
}
@@ -403,8 +399,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
boolean atLeastOneIsEnabled = false;
if (getViewer() != null) {
IDiffElement[] elements = getRoot().getChildren();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement element = elements[i];
+ for (IDiffElement element : elements) {
if (isEnabled(element)) {
atLeastOneIsEnabled = true;
break;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
index d7cbafb9b..adfae47dc 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
@@ -53,8 +53,7 @@ public class PatchProjectDiffNode extends PatchDiffNode {
private boolean containsProblems() {
IDiffElement[] elements = getChildren();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement diffElement = elements[i];
+ for (IDiffElement diffElement : elements) {
if (diffElement instanceof PatchFileDiffNode) {
PatchFileDiffNode node = (PatchFileDiffNode) diffElement;
if (node.getDiffResult().containsProblems())
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
index 34f1b86dd..88204b43a 100644
--- 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
@@ -203,15 +203,14 @@ public class Patcher implements IHunkFilter {
public void countLines() {
FilePatch2[] fileDiffs = getDiffs();
- for (int i = 0; i < fileDiffs.length; i++) {
+ for (FilePatch2 fileDiff : fileDiffs) {
int addedLines = 0;
int removedLines = 0;
- FilePatch2 fileDiff = fileDiffs[i];
for (int j = 0; j < fileDiff.getHunkCount(); j++) {
IHunk hunk = fileDiff.getHunks()[j];
String[] lines = ((Hunk) hunk).getLines();
- for (int k = 0; k < lines.length; k++) {
- char c = lines[k].charAt(0);
+ for (String line : lines) {
+ char c = line.charAt(0);
switch (c) {
case '+':
addedLines++;
@@ -517,8 +516,7 @@ public class Patcher implements IHunkFilter {
//path segment contained in all diffs.
int length= 99;
if (fDiffs!=null) {
- for (int i= 0; i<fDiffs.length; i++) {
- FilePatch2 diff= fDiffs[i];
+ for (FilePatch2 diff : fDiffs) {
length= Math.min(length, diff.segmentCount());
}
if (ResourcesPlugin.getWorkspace().getRoot().equals(fTarget))
@@ -537,9 +535,9 @@ public class Patcher implements IHunkFilter {
public void removeDiff(FilePatch2 diffToRemove){
FilePatch2[] temp = new FilePatch2[fDiffs.length - 1];
int counter = 0;
- for (int i = 0; i < fDiffs.length; i++) {
- if (fDiffs[i] != diffToRemove){
- temp[counter++] = fDiffs[i];
+ for (FilePatch2 diff : fDiffs) {
+ if (diff != diffToRemove) {
+ temp[counter++] = diff;
}
}
fDiffs = temp;
@@ -556,15 +554,15 @@ public class Patcher implements IHunkFilter {
private void setEnabledProject(DiffProject projectDiff, boolean enabled) {
FilePatch2[] diffFiles = projectDiff.getFileDiffs();
- for (int i = 0; i < diffFiles.length; i++) {
- setEnabledFile(diffFiles[i], enabled);
+ for (FilePatch2 diffFile : diffFiles) {
+ setEnabledFile(diffFile, enabled);
}
}
private void setEnabledFile(FilePatch2 fileDiff, boolean enabled) {
IHunk[] hunks = fileDiff.getHunks();
- for (int i = 0; i < hunks.length; i++) {
- setEnabledHunk((Hunk) hunks[i], enabled);
+ for (IHunk hunk : hunks) {
+ setEnabledHunk((Hunk) hunk, enabled);
}
}
@@ -619,8 +617,7 @@ public class Patcher implements IHunkFilter {
if (diffs==null||diffs.length<=0)
return -1;
int fuzz= -1;
- for (int i= 0; i<diffs.length; i++) {
- FilePatch2 d= diffs[i];
+ for (FilePatch2 d : diffs) {
IFile file= getTargetFile(d);
if (file != null && file.exists()) {
List<String> lines= LineReader.load(file, false);
@@ -642,8 +639,7 @@ public class Patcher implements IHunkFilter {
}
public void refresh(FilePatch2[] diffs) {
- for (int i = 0; i < diffs.length; i++) {
- FilePatch2 diff = diffs[i];
+ for (FilePatch2 diff : diffs) {
FileDiffResult result = getDiffResult(diff);
((WorkspaceFileDiffResult)result).refresh();
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
index 591b38335..4f72a8034 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
@@ -714,9 +714,9 @@ public class PreviewPatchPage2 extends WizardPage {
fPatcher.countLines();
FilePatch2[] fileDiffs = fPatcher.getDiffs();
- for (int i = 0; i < fileDiffs.length; i++) {
- added += fileDiffs[i].getAddedLines();
- removed += fileDiffs[i].getRemovedLines();
+ for (FilePatch2 fileDiff : fileDiffs) {
+ added += fileDiff.getAddedLines();
+ removed += fileDiff.getRemovedLines();
}
} else {
@@ -724,13 +724,9 @@ public class PreviewPatchPage2 extends WizardPage {
Pattern addedPattern = Pattern.compile(addedLinesRegex);
Pattern removedPattern = Pattern.compile(removedLinesRegex);
- FilePatch2[] fileDiffs = fPatcher.getDiffs();
- for (int i = 0; i < fileDiffs.length; i++) {
- IHunk[] hunks = fileDiffs[i].getHunks();
- for (int j = 0; j < hunks.length; j++) {
- String[] lines = ((Hunk) hunks[j]).getLines();
- for (int k = 0; k < lines.length; k++) {
- String line = lines[k];
+ for (FilePatch2 fileDiff : fPatcher.getDiffs()) {
+ for (IHunk hunk : fileDiff.getHunks()) {
+ for (String line : ((Hunk) hunk).getLines()) {
if (addedPattern.matcher(line).find())
added++;
if (removedPattern.matcher(line).find())
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
index 20f2a9314..5b9c50495 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
@@ -57,9 +57,9 @@ class RetargetPatchElementDialog extends Dialog {
// Don't show closed projects
IProject[] allProjects= ((IWorkspaceRoot) element).getProjects();
ArrayList<IProject> accessibleProjects= new ArrayList<>();
- for (int i= 0; i<allProjects.length; i++) {
- if (allProjects[i].isOpen()) {
- accessibleProjects.add(allProjects[i]);
+ for (IProject allProject : allProjects) {
+ if (allProject.isOpen()) {
+ accessibleProjects.add(allProject);
}
}
return accessibleProjects.toArray();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
index 10535ba0f..6bebffe49 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
@@ -95,8 +95,7 @@ public class WorkspacePatcher extends Patcher {
// get all files to be modified in order to call validateEdit
List<IFile> list= new ArrayList<>();
- for (int j= 0; j < fDiffProjects.length; j++) {
- DiffProject diffProject= fDiffProjects[j];
+ for (DiffProject diffProject : fDiffProjects) {
if (Utilities.getProject(diffProject).isAccessible())
list.addAll(Arrays.asList(getTargetFiles(diffProject)));
}
@@ -111,11 +110,8 @@ public class WorkspacePatcher extends Patcher {
pm.beginTask(message, diffs.length * WORK_UNIT);
}
- for (int i= 0; i < diffs.length; i++) {
-
+ for (FilePatch2 diff : diffs) {
int workTicks= WORK_UNIT;
-
- FilePatch2 diff= diffs[i];
if (isAccessible(diff)) {
IFile file= getTargetFile(diff);
IPath path= file.getProjectRelativePath();
@@ -191,8 +187,7 @@ public class WorkspacePatcher extends Patcher {
public IFile[] getTargetFiles(DiffProject project) {
List<IFile> files= new ArrayList<>();
FilePatch2[] diffs = project.getFileDiffs();
- for (int i = 0; i < diffs.length; i++) {
- FilePatch2 diff = diffs[i];
+ for (FilePatch2 diff : diffs) {
if (isEnabled(diff)) {
files.add(getTargetFile(diff));
}
@@ -221,8 +216,8 @@ public class WorkspacePatcher extends Patcher {
List<ISchedulingRule> projects= new ArrayList<>();
IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
// Determine the appropriate scheduling rules
- for (int i= 0; i < fDiffProjects.length; i++) {
- IProject tempProject= Utilities.getProject(fDiffProjects[i]);
+ for (DiffProject diffProject : fDiffProjects) {
+ IProject tempProject = Utilities.getProject(diffProject);
// The goal here is to lock as little of the workspace as necessary
// but still allow the patcher to obtain the locks it needs.
// As such, we need to get the modify rules from the rule factory for the .project file. A pessimistic
@@ -244,9 +239,9 @@ public class WorkspacePatcher extends Patcher {
public void removeProject(DiffProject project) {
DiffProject[] temp = new DiffProject[fDiffProjects.length - 1];
int counter = 0;
- for (int i = 0; i < fDiffProjects.length; i++) {
- if (fDiffProjects[i] != project){
- temp[counter++] = fDiffProjects[i];
+ for (DiffProject diffProject : fDiffProjects) {
+ if (diffProject != project) {
+ temp[counter++] = diffProject;
}
}
fDiffProjects = temp;
@@ -256,8 +251,7 @@ public class WorkspacePatcher extends Patcher {
protected Object getElementParent(Object element) {
if (element instanceof FilePatch2 && fDiffProjects != null) {
FilePatch2 diff = (FilePatch2) element;
- for (int i = 0; i < fDiffProjects.length; i++) {
- DiffProject project = fDiffProjects[i];
+ for (DiffProject project : fDiffProjects) {
if (project.contains(diff))
return project;
}
@@ -283,8 +277,8 @@ public class WorkspacePatcher extends Patcher {
}
removeDiff(diff);
FilePatch2 newDiff = getDiffForFile(file);
- for (int i = 0; i < hunks.length; i++) {
- Hunk hunk = (Hunk) hunks[i];
+ for (IHunk h : hunks) {
+ Hunk hunk = (Hunk) h;
newDiff.add(hunk);
}
}
@@ -296,9 +290,9 @@ public class WorkspacePatcher extends Patcher {
// Check if the diff project already exists for the file
IProject project = file.getProject();
DiffProject[] diffProjects = getDiffProjects();
- for (int i = 0; i < diffProjects.length; i++) {
- if (Utilities.getProject(diffProjects[i]).equals(project)){
- diffProject = diffProjects[i];
+ for (DiffProject d : diffProjects) {
+ if (Utilities.getProject(d).equals(project)) {
+ diffProject = d;
break;
}
}
@@ -311,8 +305,7 @@ public class WorkspacePatcher extends Patcher {
diffsToCheck = getDiffs();
}
// Check to see if a diff already exists for the file
- for (int i = 0; i < diffsToCheck.length; i++) {
- FilePatch2 fileDiff = diffsToCheck[i];
+ for (FilePatch2 fileDiff : diffsToCheck) {
if (isDiffForFile(fileDiff, file)) {
return fileDiff;
}
@@ -362,8 +355,8 @@ public class WorkspacePatcher extends Patcher {
if (selectedProject == null)
selectedProject = addDiffProjectForProject(targetProject);
// Copy over the diffs to the new project
- for (int i = 0; i < diffs.length; i++) {
- selectedProject.add(diffs[i]);
+ for (FilePatch2 diff : diffs) {
+ selectedProject.add(diff);
}
// Since the project has been retargeted, remove it from the patcher
removeProject(project);
@@ -381,9 +374,10 @@ public class WorkspacePatcher extends Patcher {
if (!isWorkspacePatch())
return null;
DiffProject[] projects = getDiffProjects();
- for (int i = 0; i < projects.length; i++) {
- if (Utilities.getProject(projects[i]).equals(project))
- return projects[i];
+ for (DiffProject p : projects) {
+ if (Utilities.getProject(p).equals(project)) {
+ return p;
+ }
}
return null;
}
@@ -401,9 +395,9 @@ public class WorkspacePatcher extends Patcher {
if (diffs.length == 0)
return -1;
int skip = -1;
- for (int i = 0; i < diffs.length; i++) {
- IPath oldPath = diffs[i].getPath(false);
- IPath newPath = diffs[i].getPath(true);
+ for (FilePatch2 diff : diffs) {
+ IPath oldPath = diff.getPath(false);
+ IPath newPath = diff.getPath(true);
if (checkFirstSegments(new IPath[] { oldPath, newPath },
new String[][] { { "a", "b" }, // change //$NON-NLS-1$ //$NON-NLS-2$
{ "b", "b" }, // addition //$NON-NLS-1$ //$NON-NLS-2$
@@ -428,10 +422,11 @@ public class WorkspacePatcher extends Patcher {
}
private boolean checkFirstSegments(IPath[] paths, String[][] segments) {
- SEGMENTS: for (int i = 0; i < segments.length; i++) {
+ SEGMENTS: for (String[] segment : segments) {
for (int j = 0; j < paths.length; j++) {
- if (!paths[j].segment(0).equals(segments[i][j]))
+ if (!paths[j].segment(0).equals(segment[j])) {
continue SEGMENTS;
+ }
}
return true;
}
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
index 2a5db27b8..231f235b7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
@@ -44,8 +44,8 @@ public abstract class DiffContainer extends DiffElement implements IDiffContaine
*/
public IDiffElement findChild(String name) {
Object[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- IDiffElement child= (IDiffElement) children[i];
+ for (Object c : children) {
+ IDiffElement child = (IDiffElement) c;
if (name.equals(child.getName()))
return child;
}
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
index 978a02232..1c91d01e2 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
@@ -136,8 +136,9 @@ public class DiffNode extends DiffContainer implements ICompareInput {
protected void fireChange() {
if (fListener != null) {
Object[] listeners= fListener.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ICompareInputChangeListener) listeners[i]).compareInputChanged(this);
+ for (Object listener : listeners) {
+ ((ICompareInputChangeListener) listener).compareInputChanged(this);
+ }
}
}
@@ -317,8 +318,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
public int hashCode() {
String[] path= getPath(this, 0);
int hashCode= 1;
- for (int i= 0; i < path.length; i++) {
- String s= path[i];
+ for (String s : path) {
hashCode= (31 * hashCode) + (s != null ? s.hashCode() : 0);
}
return hashCode;
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
index b698b1334..02898cf5b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
@@ -260,8 +260,7 @@ public class Differencer {
if (ancestorChildren != null) {
ancestorSet= new HashMap<>(10);
- for (int i= 0; i < ancestorChildren.length; i++) {
- Object ancestorChild= ancestorChildren[i];
+ for (Object ancestorChild : ancestorChildren) {
ancestorSet.put(ancestorChild, ancestorChild);
allSet.add(ancestorChild);
}
@@ -269,8 +268,7 @@ public class Differencer {
if (rightChildren != null) {
rightSet= new HashMap<>(10);
- for (int i= 0; i < rightChildren.length; i++) {
- Object rightChild= rightChildren[i];
+ for (Object rightChild : rightChildren) {
rightSet.put(rightChild, rightChild);
allSet.add(rightChild);
}
@@ -278,8 +276,7 @@ public class Differencer {
if (leftChildren != null) {
leftSet= new HashMap<>(10);
- for (int i= 0; i < leftChildren.length; i++) {
- Object leftChild= leftChildren[i];
+ for (Object leftChild : leftChildren) {
leftSet.put(leftChild, leftChild);
allSet.add(leftChild);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
index ac4ae690e..824323d3d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
@@ -378,8 +378,8 @@ public abstract class StructureCreator implements IStructureCreator2 {
if (tree != null) {
Object[] children= tree.getChildren();
if (children != null) {
- for (int i= 0; i < children.length; i++) {
- IStructureComparator child= (IStructureComparator) children[i];
+ for (Object c : children) {
+ IStructureComparator child = (IStructureComparator) c;
if (child instanceof ITypedElement && child instanceof DocumentRangeNode) {
String n1= ((DocumentRangeNode)child).getId();
if (n1 == null) {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
index 1604f2804..a115b9cf9 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
@@ -130,8 +130,8 @@ public class Activator implements BundleActivator {
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- childlist.add(getLog(children[i]));
+ for (IStatus child : children) {
+ childlist.add(getLog(child));
}
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
index d6bcc6860..1a47b6f04 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceManager.java
@@ -283,8 +283,7 @@ public class PreferenceManager {
// migrate proxy data
PreferenceManager instanceManager = PreferenceManager.createInstanceManager(instanceScope);
- for (int i = 0; i < proxies.length; i++) {
- ProxyType type = proxies[i];
+ for (ProxyType type : proxies) {
IProxyData data = type.getProxyData(ProxyType.DO_NOT_VERIFY);
if (data.getHost() == null) {
ProxyType instanceType = new ProxyType(type.getName(), instanceManager);
@@ -315,8 +314,7 @@ public class PreferenceManager {
if (httpProxyHost != null) {
ProxyData proxyData = new ProxyData(IProxyData.HTTP_PROXY_TYPE,
httpProxyHost, port, false, null);
- for (int i = 0; i < proxies.length; i++) {
- ProxyType type = proxies[i];
+ for (ProxyType type : proxies) {
if (type.getName().equals(proxyData.getType())) {
type.updatePreferencesIfMissing(proxyData);
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
index 67a3b002d..d7453ea7f 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
@@ -132,8 +132,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
public void setNonProxiedHosts(String[] hosts) {
checkMigrated();
Assert.isNotNull(hosts);
- for (int i = 0; i < hosts.length; i++) {
- String host = hosts[i];
+ for (String host : hosts) {
Assert.isNotNull(host);
Assert.isTrue(host.length() > 0);
}
@@ -192,8 +191,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
private IProxyData[] internalSetProxyData(IProxyData[] proxyDatas) {
List<IProxyData> result = new ArrayList<>();
- for (int i = 0; i < proxyDatas.length; i++) {
- IProxyData proxyData = proxyDatas[i];
+ for (IProxyData proxyData : proxyDatas) {
ProxyType type = getType(proxyData);
if (type != null && type.setProxyData(proxyData)) {
result.add(proxyData);
@@ -203,8 +201,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
private ProxyType getType(IProxyData proxyData) {
- for (int i = 0; i < proxies.length; i++) {
- ProxyType type = proxies[i];
+ for (ProxyType type : proxies) {
if (type.getName().equals(proxyData.getType())) {
return type;
}
@@ -252,8 +249,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
private void updateSystemProperties() {
- for (int i = 0; i < proxies.length; i++) {
- ProxyType type = proxies[i];
+ for (ProxyType type : proxies) {
type.updateSystemProperties(internalGetProxyData(type.getName(), ProxyType.DO_NOT_VERIFY));
}
}
@@ -262,8 +258,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
checkMigrated();
preferenceManager.addPreferenceChangeListener(PreferenceManager.ROOT, this);
// Now initialize each proxy type
- for (int i = 0; i < proxies.length; i++) {
- ProxyType type = proxies[i];
+ for (ProxyType type : proxies) {
type.initialize();
}
registerAuthenticator();
@@ -276,8 +271,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
private IProxyData internalGetProxyData(String type, int verifySystemProperties) {
- for (int i = 0; i < proxies.length; i++) {
- ProxyType pt = proxies[i];
+ for (ProxyType pt : proxies) {
if (pt.getName().equals(type)) {
return pt.getProxyData(verifySystemProperties);
}
@@ -303,8 +297,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return new IProxyData[0];
IProxyData[] data = getProxyData();
List<IProxyData> result = new ArrayList<>();
- for (int i = 0; i < data.length; i++) {
- IProxyData proxyData = data[i];
+ for (IProxyData proxyData : data) {
if (proxyData.getHost() != null)
result.add(proxyData);
}
@@ -326,8 +319,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
private boolean isHostFiltered(URI uri) {
String[] filters = getNonProxiedHosts();
- for (int i = 0; i < filters.length; i++) {
- String filter = filters[i];
+ for (String filter : filters) {
if (StringUtil.hostMatchesFilter(uri.getHost(), filter))
return true;
}
@@ -350,8 +342,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
IProxyData[] data = getProxyDataForHost(host);
- for (int i = 0; i < data.length; i++) {
- IProxyData proxyData = data[i];
+ for (IProxyData proxyData : data) {
if (proxyData.getType().equalsIgnoreCase(type)
&& proxyData.getHost() != null)
return resolveType(proxyData);
@@ -457,8 +448,8 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
if (data == null) {
return null;
}
- for (int i = 0; i < data.length; i++) {
- resolveType(data[i]);
+ for (IProxyData d : data) {
+ resolveType(d);
}
return data;
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
index d47165cc2..613733402 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
@@ -104,9 +104,9 @@ public class ProxyType implements INodeChangeListener, IPreferenceChangeListener
public static String[] convertPropertyStringToHosts(String property) {
String hosts[] = StringUtil.split(property, new String[] { "|" }); //$NON-NLS-1$
ArrayList<String> ret = new ArrayList<>();
- for (int i = 0; i < hosts.length; i++) {
- if (hosts[i].length() != 0) {
- ret.add(hosts[i]);
+ for (String host : hosts) {
+ if (host.length() != 0) {
+ ret.add(host);
}
}
return ret.toArray(new String[0]);
@@ -436,9 +436,9 @@ public class ProxyType implements INodeChangeListener, IPreferenceChangeListener
private IProxyData getProxyData(String type) {
IProxyData data[] = ProxySelector.getProxyData(ProxySelector
.getDefaultProvider());
- for (int i = 0; i < data.length; i++) {
- if (data[i].getType().equalsIgnoreCase(type)) {
- return data[i];
+ for (IProxyData d : data) {
+ if (d.getType().equalsIgnoreCase(type)) {
+ return d;
}
}
return new ProxyData(type, null, -1, false, null);
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
index 8a45f5624..06ffc0dee 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
@@ -55,8 +55,9 @@ public class WindowsProxyProvider extends AbstractProxyProvider {
}
if (Policy.DEBUG) {
Policy.debug("WindowsProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < proxies.length; i++)
- System.out.println(" " + proxies[i]); //$NON-NLS-1$
+ for (IProxyData proxy : proxies) {
+ System.out.println(" " + proxy); //$NON-NLS-1$
+ }
}
return proxies;
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
index 097f08574..3f07bbe14 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
@@ -55,8 +55,8 @@ public class UnixProxyProvider extends AbstractProxyProvider {
String[] nonProxyHosts = getNonProxiedHosts();
if (nonProxyHosts != null) {
String host = uri.getHost();
- for (int npIndex = 0; npIndex < nonProxyHosts.length; npIndex++) {
- if (StringUtil.hostMatchesFilter(host, nonProxyHosts[npIndex])) {
+ for (String nonProxyHost : nonProxyHosts) {
+ if (StringUtil.hostMatchesFilter(host, nonProxyHost)) {
return new IProxyData[0];
}
}
@@ -70,8 +70,9 @@ public class UnixProxyProvider extends AbstractProxyProvider {
}
if (Policy.DEBUG) {
Policy.debug("UnixProxyProvider#select result for [" + uri + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < proxies.length; i++)
- System.out.println(" " + proxies[i]); //$NON-NLS-1$
+ for (IProxyData proxy : proxies) {
+ System.out.println(" " + proxy); //$NON-NLS-1$
+ }
}
return proxies;
}
@@ -85,8 +86,7 @@ public class UnixProxyProvider extends AbstractProxyProvider {
private IProxyData[] getProxyForTypes(String[] types) {
ArrayList<IProxyData> allData = new ArrayList<>();
- for (int i = 0; i < types.length; i++) {
- String type = types[i];
+ for (String type : types) {
ProxyData pd = getSystemProxyInfo(type);
if (pd != null && pd.getHost() != null) {
allData.add(pd);
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
index 00dbc5dfc..30fa914a2 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyBypass.java
@@ -68,8 +68,7 @@ public class ProxyBypass {
* @return
*/
private boolean isInBypassList(String host) {
- for (int i = 0; i < proxyBypassEntries.length; i++) {
- String entry = proxyBypassEntries[i];
+ for (String entry : proxyBypassEntries) {
if (StringUtil.hostMatchesFilter(host, entry)) {
return true;
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
index a1b3963dc..e1c0d08e3 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
@@ -77,14 +77,14 @@ public class StaticProxyConfig {
} else {
IProxyData[] data = getUniversalProxiesData();
if (uri.getScheme() != null) {
- for (int i = 0; i < data.length; i++) {
- if (uri.getScheme().equalsIgnoreCase(data[i].getType())) {
- proxies.add(data[i]);
+ for (IProxyData d : data) {
+ if (uri.getScheme().equalsIgnoreCase(d.getType())) {
+ proxies.add(d);
}
}
} else {
- for (int i = 0; i < data.length; i++) {
- proxies.add(data[i]);
+ for (IProxyData d : data) {
+ proxies.add(d);
}
}
}
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
index fcc4a0bd0..2cbe82ef2 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
@@ -121,11 +121,9 @@ public class JSchCorePlugin extends Plugin{
String[] selected = Utils.getSelectedSSHAgent().split(","); //$NON-NLS-1$
IdentityRepository irepo = null;
- for(int i=0; i<selected.length; i++){
- for(int j=0; j<repositories.length; j++){
- IdentityRepository _irepo = repositories[j];
- if(selected[i].equals(_irepo.getName()) &&
- _irepo.getStatus()==IdentityRepository.RUNNING){
+ for(String s : selected) {
+ for(IdentityRepository _irepo : repositories) {
+ if(s.equals(_irepo.getName()) && _irepo.getStatus()==IdentityRepository.RUNNING) {
irepo = _irepo;
break;
}
@@ -153,8 +151,7 @@ public class JSchCorePlugin extends Plugin{
return new IdentityRepository[0];
ArrayList<IdentityRepository> tmp = new ArrayList<>();
- for(int i=0; i<extensions.length; i++){
- IExtension extension=extensions[i];
+ for(IExtension extension : extensions) {
IConfigurationElement[] configs=extension.getConfigurationElements();
if(configs.length==0){
JSchCorePlugin
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
index 59bfc814a..d3bf31d5c 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
@@ -90,15 +90,15 @@ public class Utils{
String[] pkey=pkeys.split(","); //$NON-NLS-1$
String[] _pkey=current_pkeys.split(","); //$NON-NLS-1$
String result=""; //$NON-NLS-1$
- for(int i=0; i<pkey.length; i++){
- file=new java.io.File(pkey[i]);
+ for(String p : pkey){
+ file=new java.io.File(p);
if(!file.isAbsolute()){
- file=new java.io.File(ssh_home, pkey[i]);
+ file=new java.io.File(ssh_home, p);
}
if(file.exists()){
boolean notyet=true;
- for(int j=0; j<_pkey.length; j++){
- if(pkey[i].equals(_pkey[j])){
+ for(String _p : _pkey){
+ if(p.equals(_p)){
notyet=false;
break;
}
@@ -107,10 +107,10 @@ public class Utils{
if(notyet)
jsch.addIdentity(file.getPath());
if(result.length()==0){
- result=pkey[i];
+ result=p;
}
else{
- result+=(","+pkey[i]); //$NON-NLS-1$
+ result+=(","+p); //$NON-NLS-1$
}
}
catch(JSchException e){
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
index 6544592a8..d96831e5d 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
@@ -259,8 +259,7 @@ protected Control createContents(Composite parent){
dir+=java.io.File.separator;
}
- for(int i=0; i<files.length; i++){
- String foo=files[i];
+ for (String foo : files) {
if(keys.length()!=0)
keys=keys+","; //$NON-NLS-1$
keys=keys+dir+foo;
@@ -788,10 +787,10 @@ protected Control createContents(Composite parent){
// Check if the generated key has been included in pkeys?
String[] pkeysa=pkeys.split(","); //$NON-NLS-1$
- for(int i=0; i<pkeysa.length; i++){
- File pkey=new java.io.File(pkeysa[i]);
- if(!pkey.isAbsolute()){
- pkey=new java.io.File(home, pkeysa[i]);
+ for (String p : pkeysa) {
+ File pkey = new java.io.File(p);
+ if (!pkey.isAbsolute()) {
+ pkey = new java.io.File(home, p);
}
if(pkey.equals(mypkey))
return;
@@ -1069,11 +1068,10 @@ protected Control createContents(Composite parent){
Set<String> smethods = new HashSet<>(Arrays.asList(methods));
String[] order = Utils.getMethodsOrder().split(","); //$NON-NLS-1$
-
- for(int i=0; i<order.length; i++){
+ for (String o : order) {
TableItem tableItem= new TableItem(preferedAuthMethodTable, SWT.NONE);
- tableItem.setText(0, order[i]);
- if(smethods.contains(order[i])){
+ tableItem.setText(0, o);
+ if (smethods.contains(o)) {
tableItem.setChecked(true);
}
}
@@ -1198,11 +1196,10 @@ protected Control createContents(Composite parent){
Set<String> smethods = new HashSet<>(Arrays.asList(methods));
String[] order = Utils.getKEXMethodsOrder().split(","); //$NON-NLS-1$
-
- for(int i=0; i<order.length; i++){
+ for (String o : order) {
TableItem tableItem= new TableItem(preferedKeyExchangeMethodTable, SWT.NONE);
- tableItem.setText(0, order[i]);
- if(smethods.contains(order[i])){
+ tableItem.setText(0, o);
+ if (smethods.contains(o)) {
tableItem.setChecked(true);
}
}
@@ -1351,14 +1348,14 @@ protected Control createContents(Composite parent){
preferedSSHAgentTable.removeAll();
String[] methods = Utils.getAvailableSSHAgents().split(","); //$NON-NLS-1$
String[] selected = Utils.getSelectedSSHAgent().split(","); //$NON-NLS-1$
-
- for(int i=0; i<methods.length; i++){
- if(methods[i].length()==0)
+ for (String method : methods) {
+ if (method.length() == 0) {
continue;
+ }
TableItem tableItem= new TableItem(preferedSSHAgentTable, SWT.NONE);
- tableItem.setText(0, methods[i]);
- for(int j=0; j<selected.length; j++){
- if(selected[j].equals(methods[i])){
+ tableItem.setText(0, method);
+ for (String s : selected) {
+ if (s.equals(method)) {
tableItem.setChecked(true);
break;
}
@@ -1372,11 +1369,10 @@ protected Control createContents(Composite parent){
Set<String> smethods = new HashSet<>(Arrays.asList(methods));
String[] order = Utils.getMACMethodsOrder().split(","); //$NON-NLS-1$
-
- for(int i=0; i<order.length; i++){
+ for (String o : order) {
TableItem tableItem= new TableItem(preferedMACMethodTable, SWT.NONE);
- tableItem.setText(0, order[i]);
- if(smethods.contains(order[i])){
+ tableItem.setText(0, o);
+ if (smethods.contains(o)) {
tableItem.setChecked(true);
}
}
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/SWTUtils.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/SWTUtils.java
index 8523a9c16..7a619885f 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/SWTUtils.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/SWTUtils.java
@@ -254,8 +254,8 @@ public class SWTUtils {
public static int getWidthInCharsForLongest(PixelConverter converter, String [] strings) {
int minimum= 0;
- for (int i = 0; i < strings.length; i++) {
- final int length= converter.convertWidthInCharsToPixels(strings[i].length());
+ for (String string : strings) {
+ final int length = converter.convertWidthInCharsToPixels(string.length());
if (minimum < length)
minimum= length;
}
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
index 63c86bd0c..1c3bbcc46 100644
--- 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
@@ -240,8 +240,7 @@ public abstract class ProjectSetCapability {
// Build a collection of existing projects
final Collection<IProject> existingProjects = new ArrayList<>();
- for (int i = 0; i < projects.length; i++) {
- IProject eachProj = projects[i];
+ for (IProject eachProj : projects) {
if (eachProj.exists()) {
existingProjects.add(eachProj);
} else if (new File(eachProj.getParent().getLocation().toFile(), eachProj.getName()).exists()) {
@@ -267,8 +266,7 @@ public abstract class ProjectSetCapability {
Collection<IProject> result = new ArrayList<>(projects.length);
result.addAll(Arrays.asList(projects));
result.removeAll(existingProjects);
- for (int i = 0; i < confirmed.length; i++) {
- IProject eachProj = confirmed[i];
+ for (IProject eachProj : confirmed) {
if (existingProjects.contains(eachProj))
result.add(eachProj);
}
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
index 8e4ba1259..9ce34692a 100644
--- 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
@@ -222,8 +222,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
if (!provider.canHandleLinkedResources()) {
try {
IResource[] members = project.members();
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
+ for (IResource resource : members) {
if (resource.isLinked()) {
throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.LINKING_NOT_ALLOWED, NLS.bind(Messages.RepositoryProvider_linkedResourcesExist, new String[] { project.getName(), id }), null));
}
@@ -502,13 +501,12 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
Set<String> 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());
+ for (IProjectNatureDescriptor d : desc) {
+ String[] setIds = d.getNatureSetIds();
+ for (String setId : setIds) {
+ if (setId.equals(TEAM_SETID)) {
+ teamSet.add(d.getNatureId());
}
}
}
@@ -550,14 +548,14 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
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]);
+ for (String natureId : natureIds) {
+ IProjectNatureDescriptor desc = workspace.getNatureDescriptor(natureId);
// 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]);
+ for (String setId : setIds) {
+ if (setId.equals(TEAM_SETID)) {
+ return getProvider(project, natureId);
}
}
}
@@ -631,8 +629,8 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
return null;
String[] setIds = desc.getNatureSetIds();
- for (int i = 0; i < setIds.length; i++) {
- if(setIds[i].equals(TEAM_SETID)) {
+ for (String setId : setIds) {
+ if (setId.equals(TEAM_SETID)) {
return (RepositoryProvider)project.getNature(id);
}
}
@@ -714,10 +712,10 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
+ for (IExtension e : extensions) {
+ IConfigurationElement[] configElements = e.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
allIDs.add(extensionId);
}
}
@@ -732,17 +730,17 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
if (extensionId != null && extensionId.equals(id)) {
try {
- return (RepositoryProvider) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ return (RepositoryProvider) configElement.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
TeamPlugin.log(e);
} catch (ClassCastException e) {
- String className = configElements[j].getAttribute("class"); //$NON-NLS-1$
+ String className = configElement.getAttribute("class"); //$NON-NLS-1$
TeamPlugin.log(IStatus.ERROR, NLS.bind(Messages.RepositoryProvider_invalidClass, new String[] { id, className }), e);
}
return null;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
index 62ca83791..ac06da4d5 100644
--- 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
@@ -14,7 +14,6 @@
package org.eclipse.team.core;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
@@ -107,8 +106,7 @@ public abstract class RepositoryProviderType extends PlatformObject {
* @since 3.2
*/
public static RepositoryProviderType getTypeForScheme(String scheme) {
- for (Iterator iter = allProviderTypes.values().iterator(); iter.hasNext();) {
- RepositoryProviderType type = (RepositoryProviderType) iter.next();
+ for (RepositoryProviderType type : allProviderTypes.values()) {
if (type.getFileSystemScheme() != null && type.getFileSystemScheme().equals(scheme))
return type;
}
@@ -119,11 +117,11 @@ public abstract class RepositoryProviderType extends PlatformObject {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
- String typeScheme = configElements[j].getAttribute("fileSystemScheme"); //$NON-NLS-1$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
+ String typeScheme = configElement.getAttribute("fileSystemScheme"); //$NON-NLS-1$
if (typeScheme != null && typeScheme.equals(scheme) && extensionId != null) {
return newProviderType(extensionId);
}
@@ -141,30 +139,28 @@ public abstract class RepositoryProviderType extends PlatformObject {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
-
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
if (extensionId != null && extensionId.equals(id)) {
try {
RepositoryProviderType providerType;
//Its ok not to have a typeClass extension. In this case, a default instance will be created.
- if(configElements[j].getAttribute("typeClass") == null) { //$NON-NLS-1$
+ if (configElement.getAttribute("typeClass") == null) { //$NON-NLS-1$
providerType = new DefaultRepositoryProviderType();
} else {
- providerType = (RepositoryProviderType) configElements[j].createExecutableExtension("typeClass"); //$NON-NLS-1$
+ providerType = (RepositoryProviderType) configElement.createExecutableExtension("typeClass"); //$NON-NLS-1$
}
-
providerType.setID(id);
allProviderTypes.put(id, providerType);
- String scheme = configElements[j].getAttribute("fileSystemScheme"); //$NON-NLS-1$
+ String scheme = configElement.getAttribute("fileSystemScheme"); //$NON-NLS-1$
providerType.setFileSystemScheme(scheme);
return providerType;
} catch (CoreException e) {
TeamPlugin.log(e);
} catch (ClassCastException e) {
- String className = configElements[j].getAttribute("typeClass"); //$NON-NLS-1$
+ String className = configElement.getAttribute("typeClass"); //$NON-NLS-1$
TeamPlugin.log(IStatus.ERROR, "Class " + className + " registered for repository provider type id " + id + " is not a subclass of RepositoryProviderType", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
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
index d65e49f24..d25103c29 100644
--- 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
@@ -156,12 +156,14 @@ public final class Team {
private static boolean matchesEnabledIgnore(IResource resource) {
StringMatcher[] matchers = getStringMatchers();
- for (int i = 0; i < matchers.length; i++) {
+ for (StringMatcher matcher : matchers) {
String resourceName = resource.getName();
- if(matchers[i].isPathPattern()) {
+ if (matcher.isPathPattern()) {
resourceName = resource.getFullPath().toString();
}
- if (matchers[i].match(resourceName)) return true;
+ if (matcher.match(resourceName)) {
+ return true;
+ }
}
return false;
}
@@ -249,9 +251,9 @@ public final class Team {
if (ignoreMatchers==null) {
IIgnoreInfo[] ignorePatterns = getAllIgnores();
ArrayList<StringMatcher> matchers = new ArrayList<>(ignorePatterns.length);
- for (int i = 0; i < ignorePatterns.length; i++) {
- if (ignorePatterns[i].getEnabled()) {
- matchers.add(new StringMatcher(ignorePatterns[i].getPattern(), true, false));
+ for (IIgnoreInfo ignorePattern : ignorePatterns) {
+ if (ignorePattern.getEnabled()) {
+ matchers.add(new StringMatcher(ignorePattern.getPattern(), true, false));
}
}
ignoreMatchers = new StringMatcher[matchers.size()];
@@ -295,13 +297,11 @@ public final class Team {
}
// Now set into preferences
StringBuilder buf = new StringBuilder();
- Iterator e = globalIgnore.entrySet().iterator();
- while (e.hasNext()) {
- Map.Entry entry = (Entry) e.next();
+ for (Map.Entry entry : globalIgnore.entrySet()) {
String pattern = (String) entry.getKey();
Boolean value = (Boolean) entry.getValue();
boolean isCustom = (!pluginIgnore.containsKey(pattern)) ||
- !pluginIgnore.get(pattern).equals(value);
+ !pluginIgnore.get(pattern).equals(value);
if (isCustom) {
buf.append(pattern);
buf.append(PREF_TEAM_SEPARATOR);
@@ -309,7 +309,6 @@ public final class Team {
buf.append(en);
buf.append(PREF_TEAM_SEPARATOR);
}
-
}
TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_IGNORES, buf.toString());
}
@@ -328,15 +327,15 @@ public final class Team {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String pattern = configElement.getAttribute("pattern"); //$NON-NLS-1$
if (pattern != null) {
- String selected = configElements[j].getAttribute("enabled"); //$NON-NLS-1$
+ String selected = configElement.getAttribute("enabled"); //$NON-NLS-1$
if (selected == null) {
// Check for selected because this used to be the field name
- selected = configElements[j].getAttribute("selected"); //$NON-NLS-1$
+ selected = configElement.getAttribute("selected"); //$NON-NLS-1$
}
boolean enabled = selected != null
&& selected.equalsIgnoreCase("true"); //$NON-NLS-1$
@@ -382,17 +381,15 @@ public final class Team {
String patternToFind, IExtension[] extensions) {
StringBuilder sb = new StringBuilder();
boolean isFirst = true;
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i]
- .getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- if (patternToFind.equals(configElements[j]
- .getAttribute("pattern"))) { //$NON-NLS-1$
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ if (patternToFind.equals(configElement.getAttribute("pattern"))) { //$NON-NLS-1$
if (!isFirst) {
sb.append(", "); //$NON-NLS-1$
}
isFirst = false;
- sb.append(extensions[i].getContributor().getName());
+ sb.append(extension.getContributor().getName());
}
}
}
@@ -494,13 +491,13 @@ public final class Team {
IExtensionPoint extension = RegistryFactory.getRegistry().getExtensionPoint(TeamPlugin.ID, 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$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
if (extensionId != null && extensionId.equals(id)) {
try {
- return (IProjectSetSerializer)configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ return (IProjectSetSerializer) configElement.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
TeamPlugin.log(e);
return null;
@@ -642,8 +639,8 @@ public final class Team {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.EXTENSION_POINT_BUNDLE_IMPORTERS);
if (point != null) {
IConfigurationElement[] infos = point.getConfigurationElements();
- for (int i = 0; i < infos.length; i++) {
- fBundleImporters.add(new BundleImporterExtension(infos[i]));
+ for (IConfigurationElement info : infos) {
+ fBundleImporters.add(new BundleImporterExtension(info));
}
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
index 6163c84ba..5cb113a49 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
@@ -15,7 +15,6 @@ package org.eclipse.team.core.diff.provider;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -93,8 +92,7 @@ public class DiffTree implements IDiffTree {
if (depth == IResource.DEPTH_ZERO)
return;
IPath[] children = getChildren(path);
- for (int i = 0; i < children.length; i++) {
- IPath child = children[i];
+ for (IPath child : children) {
accept(child, visitor, depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE);
}
}
@@ -244,8 +242,8 @@ public class DiffTree implements IDiffTree {
if(event.isEmpty() && ! event.isReset() && propertyChanges.isEmpty()) return;
Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IDiffChangeListener listener = (IDiffChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IDiffChangeListener listener = (IDiffChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -257,8 +255,7 @@ public class DiffTree implements IDiffTree {
lockedForModification = true;
if (!event.isEmpty() || event.isReset())
listener.diffsChanged(event, Policy.subMonitorFor(monitor, 100));
- for (Iterator<Integer> iter = propertyChanges.keySet().iterator(); iter.hasNext();) {
- Integer key = iter.next();
+ for (Integer key : propertyChanges.keySet()) {
Set<IPath> paths = propertyChanges.get(key);
listener.propertyChanged(DiffTree.this, key.intValue(), paths.toArray(new IPath[paths
.size()]));
@@ -371,8 +368,7 @@ public class DiffTree implements IDiffTree {
changes = new HashSet<>();
propertyChanges.put(key, changes);
}
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
changes.add(path);
}
}
@@ -386,8 +382,7 @@ public class DiffTree implements IDiffTree {
public void setBusy(IDiff[] diffs, IProgressMonitor monitor) {
try {
beginInput();
- for (int i = 0; i < diffs.length; i++) {
- IDiff node = diffs[i];
+ for (IDiff node : diffs) {
setPropertyToRoot(node, P_BUSY_HINT, true);
}
} finally {
@@ -400,8 +395,7 @@ public class DiffTree implements IDiffTree {
try {
beginInput();
IPath[] paths = pathTree.getPaths();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
IPath[] changed = pathTree.setPropogatedProperty(path, P_BUSY_HINT, false);
accumulatePropertyChanges(P_BUSY_HINT, changed);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
index 1915ad01a..e5e43281e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
@@ -67,8 +67,7 @@ public abstract class BundleImporterDelegate implements IBundleImporterDelegate
if (getSupportedValues().contains(prefix)) {
try {
ManifestElement[] elements = ManifestElement.parseHeader(ECLIPSE_SOURCE_REFERENCES, value);
- for (int j = 0; j < elements.length; j++) {
- ManifestElement element = elements[j];
+ for (ManifestElement element : elements) {
String url = element.toString();
String project = element.getAttribute(ATTR_PROJECT);
if (project == null) {
@@ -97,8 +96,7 @@ public abstract class BundleImporterDelegate implements IBundleImporterDelegate
IProject[] result = null;
if (psfCapability != null) {
// collect and validate all header values
- for (int i = 0; i < descriptions.length; i++) {
- ScmUrlImportDescription description = descriptions[i];
+ for (ScmUrlImportDescription description : descriptions) {
references.add(psfCapability.asReference(description.getUri(), description.getProject()));
}
// create projects
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
index c3d6cd6a1..dbf9c7b75 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
@@ -59,8 +59,7 @@ public abstract class ChangeTracker {
if (disposed) return;
IResourceDelta delta = event.getDelta();
IResourceDelta[] projectDeltas = delta.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED);
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta projectDelta = projectDeltas[i];
+ for (IResourceDelta projectDelta : projectDeltas) {
IResource resource = projectDelta.getResource();
if (resource.getType() == IResource.PROJECT) {
IProject project = (IProject)resource;
@@ -117,8 +116,7 @@ public abstract class ChangeTracker {
ResourcesPlugin.getWorkspace().addResourceChangeListener(changeListener, IResourceChangeEvent.POST_CHANGE);
RepositoryProviderManager.getInstance().addListener(changeListener);
IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- IProject project = allProjects[i];
+ for (IProject project : allProjects) {
if (isProjectOfInterest(project))
trackProject(project);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java
index b3c994661..702087800 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java
@@ -71,11 +71,9 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
public ISchedulingRule getMergeRule(IMergeContext context) {
ResourceMapping[] mappings = context.getScope().getMappings(getModelProvider().getId());
ISchedulingRule rule = null;
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
IProject[] mappingProjects = mapping.getProjects();
- for (int j = 0; j < mappingProjects.length; j++) {
- IProject project = mappingProjects[j];
+ for (IProject project : mappingProjects) {
if (rule == null) {
rule = project;
} else {
@@ -105,12 +103,10 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
private IDiff[] getSetToMerge(IMergeContext mergeContext) {
ResourceMapping[] mappings = mergeContext.getScope().getMappings(getModelProvider().getDescriptor().getId());
Set<IDiff> result = new HashSet<>();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] traversals = mergeContext.getScope().getTraversals(mapping);
IDiff[] deltas = mergeContext.getDiffTree().getDiffs(traversals);
- for (int j = 0; j < deltas.length; j++) {
- IDiff delta = deltas[j];
+ for (IDiff delta : deltas) {
result.add(delta);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
index 5a29fe4ea..41ff492e5 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
@@ -86,8 +86,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
@Override
public void reject(final IDiff[] diffs, IProgressMonitor monitor) throws CoreException {
run(monitor1 -> {
- for (int i = 0; i < diffs.length; i++) {
- IDiff node = diffs[i];
+ for (IDiff node : diffs) {
reject(node, monitor1);
}
}, getMergeRule(diffs), IResource.NONE, monitor);
@@ -96,8 +95,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
@Override
public void markAsMerged(final IDiff[] nodes, final boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
run(monitor1 -> {
- for (int i = 0; i < nodes.length; i++) {
- IDiff node = nodes[i];
+ for (IDiff node : nodes) {
markAsMerged(node, inSyncHint, monitor1);
}
}, getMergeRule(nodes), IResource.NONE, monitor);
@@ -109,8 +107,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
run(monitor1 -> {
try {
monitor1.beginTask(null, deltas.length * 100);
- for (int i = 0; i < deltas.length; i++) {
- IDiff delta = deltas[i];
+ for (IDiff delta : deltas) {
IStatus s = merge(delta, force, Policy.subMonitorFor(monitor1, 100));
if (!s.isOK()) {
if (s.getCode() == IMergeStatus.CONFLICTS) {
@@ -459,8 +456,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
@Override
public ISchedulingRule getMergeRule(IDiff[] deltas) {
ISchedulingRule result = null;
- for (int i = 0; i < deltas.length; i++) {
- IDiff node = deltas[i];
+ for (IDiff node : deltas) {
ISchedulingRule rule = getMergeRule(node);
if (result == null) {
result = rule;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java
index 5926d6dcd..0f7bf3ebb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java
@@ -83,11 +83,9 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
@Override
public void accept(ResourceTraversal[] traversals, IDiffVisitor visitor) {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ for (IResource resource : resources) {
accept(resource.getFullPath(), visitor, traversal.getDepth());
}
}
@@ -96,11 +94,9 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
@Override
public IDiff[] getDiffs(final ResourceTraversal[] traversals) {
final Set<IDiff> result = new HashSet<>();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ for (IResource resource : resources) {
internalGetDiffs(resource, traversal.getDepth(), result);
}
}
@@ -131,8 +127,7 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
public IResource[] members(IResource resource) {
List<IResource> result = new ArrayList<>();
IPath[] paths = getChildren(resource.getFullPath());
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
IDiff node = getDiff(path);
if (node == null) {
result.add(internalGetResource(path, true));
@@ -147,8 +142,7 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
public IResource[] getAffectedResources() {
List<IResource> result = new ArrayList<>();
IDiff[] nodes = getDiffs();
- for (int i = 0; i < nodes.length; i++) {
- IDiff node = nodes[i];
+ for (IDiff node : nodes) {
result.add(getResource(node));
}
return result.toArray(new IResource[result.size()]);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java
index b66e9021d..b6c694a8e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java
@@ -99,8 +99,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
Set<ResourceMapping> result = new HashSet<>();
IModelProviderDescriptor[] descriptors = ModelProvider
.getModelProviderDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- IModelProviderDescriptor descriptor = descriptors[i];
+ for (IModelProviderDescriptor descriptor : descriptors) {
ResourceMapping[] mappings = getMappings(descriptor, traversals,
context, monitor);
result.addAll(Arrays.asList(mappings));
@@ -153,8 +152,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
public ISchedulingRule getSchedulingRule() {
Set<IProject> projects = new HashSet<>();
ResourceMapping[] mappings = scope.getInputMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
Object modelObject = mapping.getModelObject();
if (modelObject instanceof IResource) {
IResource resource = (IResource) modelObject;
@@ -229,8 +227,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
ScopeChangeEvent change = new ScopeChangeEvent(scope);
CompoundResourceTraversal refreshTraversals = new CompoundResourceTraversal();
CompoundResourceTraversal removedTraversals = new CompoundResourceTraversal();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] previousTraversals = scope.getTraversals(mapping);
ResourceTraversal[] mappingTraversals = mapping.getTraversals(
context, Policy.subMonitorFor(monitor, 100));
@@ -289,8 +286,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
private ResourceMapping findAncestor(ResourceMapping mapping) {
ResourceMapping[] mappings = scope.getMappings(mapping.getModelProviderId());
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping m = mappings[i];
+ for (ResourceMapping m : mappings) {
if (m.contains(mapping)) {
return m;
}
@@ -389,8 +385,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
IProgressMonitor monitor) throws CoreException {
CompoundResourceTraversal result = new CompoundResourceTraversal();
ResourceMappingContext context = this.context;
- for (int i = 0; i < targetMappings.length; i++) {
- ResourceMapping mapping = targetMappings[i];
+ for (ResourceMapping mapping : targetMappings) {
if (scope.getTraversals(mapping) == null) {
ResourceTraversal[] traversals = mapping.getTraversals(context,
Policy.subMonitorFor(monitor, 100));
@@ -421,12 +416,10 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
ResourceMapping[] mappings = scope.getMappings();
if (inputMappings.length == mappings.length) {
Set<ResourceMapping> testSet = new HashSet<>();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
testSet.add(mapping);
}
- for (int i = 0; i < inputMappings.length; i++) {
- ResourceMapping mapping = inputMappings[i];
+ for (ResourceMapping mapping : inputMappings) {
if (!testSet.contains(mapping)) {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
index 4896b3421..3a3271f22 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
@@ -265,8 +265,7 @@ abstract public class Subscriber {
public void collectOutOfSync(IResource[] resources, int depth, SyncInfoSet set, IProgressMonitor monitor) {
try {
monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 100);
subMonitor.beginTask(null, IProgressMonitor.UNKNOWN);
collect(resource, depth, set, subMonitor);
@@ -290,8 +289,7 @@ abstract public class Subscriber {
allListeners = listeners.toArray(new ISubscriberChangeListener[listeners.size()]);
}
// Notify the listeners safely so all will receive notification
- for (int i = 0; i < allListeners.length; i++) {
- final ISubscriberChangeListener listener = allListeners[i];
+ for (ISubscriberChangeListener listener : allListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -322,14 +320,10 @@ abstract public class Subscriber {
&& depth != IResource.DEPTH_ZERO) {
try {
IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- collect(
- members[i],
- depth == IResource.DEPTH_INFINITE
+ for (IResource member : members) {
+ collect(member, depth == IResource.DEPTH_INFINITE
? IResource.DEPTH_INFINITE
- : IResource.DEPTH_ZERO,
- set,
- monitor);
+ : IResource.DEPTH_ZERO, set, monitor);
}
} catch (TeamException e) {
set.addError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_ERROR, NLS.bind(Messages.SubscriberEventHandler_8, new String[] { resource.getFullPath().toString(), e.getMessage() }), e, resource));
@@ -406,8 +400,7 @@ abstract public class Subscriber {
* @since 3.2
*/
public void accept(ResourceTraversal[] traversals, IDiffVisitor visitor) throws CoreException {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
accept(traversal.getResources(), traversal.getDepth(), visitor);
}
}
@@ -434,8 +427,7 @@ abstract public class Subscriber {
* @since 3.2
*/
public void accept(IResource[] resources, int depth, IDiffVisitor visitor) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
accept(resource, depth, visitor);
}
}
@@ -449,8 +441,7 @@ abstract public class Subscriber {
if (depth != IResource.DEPTH_ZERO) {
IResource[] members = members(resource);
int newDepth = depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO;
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
accept(member, newDepth, visitor);
}
}
@@ -476,8 +467,7 @@ abstract public class Subscriber {
*/
public void refresh(ResourceTraversal[] traversals, IProgressMonitor monitor) throws TeamException {
monitor.beginTask(null, 100 * traversals.length);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
refresh(traversal.getResources(), traversal.getDepth(), Policy.subMonitorFor(monitor, 100));
}
monitor.done();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java
index b1f3d8817..695368f5a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java
@@ -148,8 +148,7 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
@Override
public final void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
subscriber.refresh(traversals, monitor);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
refreshed(traversal.getResources(), traversal.getDepth());
}
}
@@ -178,8 +177,7 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
* @param depth the depth to which the resources were refreshed
*/
protected final void refreshed(IResource[] resources, int depth) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
// Include files and depth-one folders as shallow
if (depth == IResource.DEPTH_ONE || resource.getType() == IResource.FILE) {
shallowRefresh.add(resource);
@@ -293,8 +291,7 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
public IProject[] getProjects() {
Set<IProject> projects = new HashSet<>();
IResource[] roots = subscriber.roots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
projects.add(resource.getProject());
}
return projects.toArray(new IProject[projects.size()]);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
index 87342d7a5..aed94334d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
@@ -73,8 +73,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
}
@Override
public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- FastSyncInfoFilter filter = filters[i];
+ for (FastSyncInfoFilter filter : filters) {
if (!filter.select(info)) {
return false;
}
@@ -116,8 +115,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
}
@Override
public boolean select(SyncInfo info) {
- for (int i = 0; i < filters.length; i++) {
- FastSyncInfoFilter filter = filters[i];
+ for (FastSyncInfoFilter filter : filters) {
if (filter.select(info)) {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
index beb723704..6e3a12b3d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
@@ -78,8 +78,8 @@ public class SyncInfoSet {
public SyncInfoSet(SyncInfo[] infos) {
this();
// use the internal add since we can't have listeners at this point anyway
- for (int i = 0; i < infos.length; i++) {
- internalAdd(infos[i]);
+ for (SyncInfo info : infos) {
+ internalAdd(info);
}
}
@@ -102,8 +102,7 @@ public class SyncInfoSet {
public IResource[] getResources() {
SyncInfo[] infos = getSyncInfos();
List<IResource> resources = new ArrayList<>();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
resources.add(info.getLocal());
}
return resources.toArray(new IResource[resources.size()]);
@@ -346,8 +345,8 @@ public class SyncInfoSet {
try {
beginInput();
SyncInfo[] infos = set.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- add(infos[i]);
+ for (SyncInfo info : infos) {
+ add(info);
}
} finally {
endInput(null);
@@ -377,8 +376,8 @@ public class SyncInfoSet {
public void removeAll(IResource[] resources) {
try {
beginInput();
- for (int i = 0; i < resources.length; i++) {
- remove(resources[i]);
+ for (IResource resource : resources) {
+ remove(resource);
}
} finally {
endInput(null);
@@ -414,8 +413,7 @@ public class SyncInfoSet {
*/
public boolean hasNodes(FastSyncInfoFilter filter) {
SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
if (info != null && filter.select(info)) {
return true;
}
@@ -433,8 +431,7 @@ public class SyncInfoSet {
try {
beginInput();
SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
if (info == null || !filter.select(info)) {
remove(info.getLocal());
}
@@ -454,8 +451,7 @@ public class SyncInfoSet {
try {
beginInput();
SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
if (info != null && filter.select(info)) {
remove(info.getLocal());
}
@@ -474,8 +470,7 @@ public class SyncInfoSet {
public SyncInfo[] getNodes(FastSyncInfoFilter filter) {
List<SyncInfo> result = new ArrayList<>();
SyncInfo[] infos = getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
if (info != null && filter.select(info)) {
result.add(info);
}
@@ -580,8 +575,7 @@ public class SyncInfoSet {
// Fire the events using an ISafeRunnable
final ITeamStatus[] newErrors = event.getErrors();
monitor.beginTask(null, 100 + (newErrors.length > 0 ? 50 : 0) * allListeners.length);
- for (int i = 0; i < allListeners.length; i++) {
- final ISyncInfoSetChangeListener listener = allListeners[i];
+ for (ISyncInfoSetChangeListener listener : allListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
index 0a55b352a..1d73e387e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
@@ -59,8 +59,7 @@ public class SyncInfoTree extends SyncInfoSet {
*/
public SyncInfoTree(SyncInfo[] infos) {
super(infos);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
IResource local = info.getLocal();
addToParents(local, local);
}
@@ -119,8 +118,7 @@ public class SyncInfoTree extends SyncInfoSet {
result.add(info);
}
IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
info = getSyncInfo(member);
if (info != null) {
result.add(info);
@@ -145,8 +143,7 @@ public class SyncInfoTree extends SyncInfoSet {
private synchronized SyncInfo[] internalGetDeepSyncInfo(IContainer resource) {
List<SyncInfo> infos = new ArrayList<>();
IResource[] children = internalGetOutOfSyncDescendants(resource);
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
+ for (IResource child : children) {
SyncInfo info = getSyncInfo(child);
if(info != null) {
infos.add(info);
@@ -284,16 +281,15 @@ public class SyncInfoTree extends SyncInfoSet {
if (depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE) return;
if (depth == IResource.DEPTH_ONE) {
IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
if (getSyncInfo(member) != null) {
remove(member);
}
}
} else if (depth == IResource.DEPTH_INFINITE) {
IResource [] toRemove = internalGetOutOfSyncDescendants((IContainer)resource);
- for (int i = 0; i < toRemove.length; i++) {
- remove(toRemove[i]);
+ for (IResource t : toRemove) {
+ remove(t);
}
}
} finally {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java
index fe817cc17..a74000d3c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java
@@ -66,8 +66,7 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
List<IResource> changedResources = new ArrayList<>();
monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IResource[] changed = refresh(resource, depth, Policy.subMonitorFor(monitor, 100));
changedResources.addAll(Arrays.asList(changed));
}
@@ -223,8 +222,7 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
if (localChildren.length > 0) {
localSet = new HashMap<>(10);
- for (int i = 0; i < localChildren.length; i++) {
- IResource localChild = localChildren[i];
+ for (IResource localChild : localChildren) {
String name = localChild.getName();
localSet.put(name, localChild);
allSet.add(name);
@@ -233,38 +231,34 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
if (remoteChildren.length > 0) {
remoteSet = new HashMap<>(10);
- for (int i = 0; i < remoteChildren.length; i++) {
- IResourceVariant remoteChild = remoteChildren[i];
+ for (IResourceVariant remoteChild : remoteChildren) {
String name = remoteChild.getName();
remoteSet.put(name, remoteChild);
allSet.add(name);
}
}
- Iterator e = allSet.iterator();
- while (e.hasNext()) {
- String keyChildName = (String) e.next();
-
+ for (String keyChildName : allSet) {
Policy.checkCanceled(progress);
IResource localChild =
- localSet != null ? (IResource) localSet.get(keyChildName) : null;
-
- IResourceVariant remoteChild =
+ localSet != null ? (IResource) localSet.get(keyChildName) : null;
+
+ IResourceVariant remoteChild =
remoteSet != null ? (IResourceVariant) remoteSet.get(keyChildName) : null;
-
- if (localChild == null) {
- // there has to be a remote resource available if we got this far
- Assert.isTrue(remoteChild != null);
- boolean isContainer = remoteChild.isContainer();
- localChild = getResourceChild(local /* parent */, keyChildName, isContainer);
- }
- if (localChild == null) {
- TeamPlugin.log(IStatus.ERROR, NLS.bind("File {0} cannot be the parent of remote resource {1}", //$NON-NLS-1$
- new Object[] { local.getFullPath(), keyChildName }), null);
- } else {
- mergedResources.put(localChild, remoteChild);
- }
+
+ if (localChild == null) {
+ // there has to be a remote resource available if we got this far
+ Assert.isTrue(remoteChild != null);
+ boolean isContainer = remoteChild.isContainer();
+ localChild = getResourceChild(local /* parent */, keyChildName, isContainer);
+ }
+ if (localChild == null) {
+ TeamPlugin.log(IStatus.ERROR, NLS.bind("File {0} cannot be the parent of remote resource {1}", //$NON-NLS-1$
+ new Object[] { local.getFullPath(), keyChildName }), null);
+ } else {
+ mergedResources.put(localChild, remoteChild);
+ }
}
}
return mergedResources;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
index dea3b6181..3080d9609 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
@@ -138,8 +138,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
// Filter and return only resources that have sync bytes in the cache.
IResource[] members = ((IContainer)resource).members(true /* include phantoms */);
List<IResource> filteredMembers = new ArrayList<>(members.length);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
if(getBytes(member) != null) {
filteredMembers.add(member);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
index 9d4420a3a..ea88f25f4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
@@ -119,8 +119,7 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
List<IStatus> cancels = new ArrayList<>();
try {
monitor.beginTask(null, 1000 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.getProject().isAccessible()) {
IStatus status = refresh(resource, depth, Policy.subMonitorFor(monitor, 1000));
if (status.getSeverity() == IStatus.CANCEL) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java
index 2c7fb888b..5f4b61764 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java
@@ -53,8 +53,7 @@ public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
if (getSyncBytesCache().containsKey(resource)) {
if (depth != IResource.DEPTH_ZERO) {
IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
+ for (IResource child : members) {
flushBytes(child, (depth == IResource.DEPTH_INFINITE) ? IResource.DEPTH_INFINITE: IResource.DEPTH_ZERO);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java
index 0aeb221f8..297a045d4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java
@@ -159,8 +159,7 @@ public abstract class ThreeWaySubscriber extends ResourceVariantTreeSubscriber i
private boolean isChildOfRoot(IResource resource) {
IResource[] roots = roots();
IPath fullPath = resource.getFullPath();
- for (int i = 0; i < roots.length; i++) {
- IResource root = roots[i];
+ for (IResource root : roots) {
if (root.getFullPath().isPrefixOf(fullPath)) {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java
index 5ce6d8b81..94b4572ae 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java
@@ -418,8 +418,7 @@ public class ThreeWaySynchronizer {
allListeners = listeners.toArray(new ISynchronizerChangeListener[listeners.size()]);
}
// Notify the listeners safely so all will receive notification
- for (int i = 0; i < allListeners.length; i++) {
- final ISynchronizerChangeListener listener = allListeners[i];
+ for (ISynchronizerChangeListener listener : allListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
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
index a01b75680..200035bfa 100644
--- 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
@@ -87,8 +87,7 @@ public class DefaultFileModificationValidator extends FileModificationValidator
private IFile[] getReadOnly(IFile[] files) {
List<IFile> result = new ArrayList<>(files.length);
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
if (file.isReadOnly()) {
result.add(file);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
index 8c956d1a9..bc784a0d3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
@@ -104,8 +104,7 @@ public class ExceptionCollector {
IStatus status = new Status(exceptionStatus.getSeverity(), exceptionStatus.getPlugin(), exceptionStatus.getCode(), exceptionStatus.getMessage(), exception);
recordStatus(status);
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus status2 = children[i];
+ for (IStatus status2 : children) {
recordStatus(status2);
}
}
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
index c8dc7055e..3426ac6e3 100644
--- 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
@@ -44,8 +44,7 @@ public class FileModificationValidatorManager extends FileModificationValidator
Map<RepositoryProvider, List<IFile>> 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];
+ for (IFile file : files) {
RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject());
if (!providersToFiles.containsKey(provider)) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
index 8193e6ae4..85ae03f65 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
@@ -57,16 +57,13 @@ public class PluginStringMappings {
final 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++) {
-
- final String ext = configElements[j].getAttribute(fAttributeName);//"extension");
- final String type = configElements[j].getAttribute("type"); //$NON-NLS-1$
+ for (IExtension e : extensions) {
+ IConfigurationElement[] configElements = e.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ final String ext = configElement.getAttribute(fAttributeName); //"extension");
+ final String type = configElement.getAttribute("type"); //$NON-NLS-1$
if (ext == null || type == null)
continue;
-
if (type.equals("text")) { //$NON-NLS-1$
result.put(ext, Integer.valueOf(Team.TEXT));
} else if (type.equals("binary")) { //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
index 48744eb2f..351a961e1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
@@ -32,8 +32,8 @@ public class RepositoryProviderManager implements IRepositoryProviderListener {
@Override
public void providerMapped(RepositoryProvider provider) {
Object[] allListeners = listeners.getListeners();
- for (int i = 0; i < allListeners.length; i++) {
- IRepositoryProviderListener listener = (IRepositoryProviderListener)allListeners[i];
+ for (Object l : allListeners) {
+ IRepositoryProviderListener listener = (IRepositoryProviderListener) l;
listener.providerMapped(provider);
}
}
@@ -41,8 +41,8 @@ public class RepositoryProviderManager implements IRepositoryProviderListener {
@Override
public void providerUnmapped(IProject project) {
Object[] allListeners = listeners.getListeners();
- for (int i = 0; i < allListeners.length; i++) {
- IRepositoryProviderListener listener = (IRepositoryProviderListener)allListeners[i];
+ for (Object l : allListeners) {
+ IRepositoryProviderListener listener = (IRepositoryProviderListener) l;
listener.providerUnmapped(project);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
index ba1bf5be1..22d753890 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
@@ -17,7 +17,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -100,8 +99,7 @@ public class ResourceVariantCache {
public static synchronized void shutdown() {
String[] keys = caches.keySet().toArray(new String[caches.size()]);
- for (int i = 0; i < keys.length; i++) {
- String id = keys[i];
+ for (String id : keys) {
disableCache(id);
}
}
@@ -131,8 +129,7 @@ public class ResourceVariantCache {
long current = new Date().getTime();
if ((lastCacheCleanup!=-1) && (current - lastCacheCleanup < CACHE_FILE_LIFESPAN)) return;
List<ResourceVariantCacheEntry> stale = new ArrayList<>();
- for (Iterator iter = cacheEntries.values().iterator(); iter.hasNext();) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry) iter.next();
+ for (ResourceVariantCacheEntry entry : cacheEntries.values()) {
long lastHit = entry.getLastAccessTimeStamp();
if ((current - lastHit) > CACHE_FILE_LIFESPAN){
stale.add(entry);
@@ -199,8 +196,8 @@ public class ResourceVariantCache {
if(children == null) {
throw new TeamException(NLS.bind(Messages.RemoteContentsCache_fileError, new String[] { file.getAbsolutePath() }));
}
- for (int i = 0; i < children.length; i++) {
- deleteFile(children[i]);
+ for (File f : children) {
+ deleteFile(f);
}
}
if (! file.delete()) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java
index 4c6095879..943b554cb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java
@@ -96,12 +96,11 @@ public class StorageMergerRegistry {
// collect all IStreamMergers
IConfigurationElement[] elements= registry.getConfigurationElementsFor(TeamPlugin.ID, STORAGE_MERGER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (STORAGE_MERGER.equals(element.getName()))
- register(element, new StorageMergerDescriptor(element));
- else if (CONTENT_TYPE_BINDING.equals(element.getName()))
- createBinding(element, STORAGE_MERGER_ID_ATTRIBUTE);
+ for (IConfigurationElement element : elements) {
+ if (STORAGE_MERGER.equals(element.getName()))
+ register(element, new StorageMergerDescriptor(element));
+ else if (CONTENT_TYPE_BINDING.equals(element.getName()))
+ createBinding(element, STORAGE_MERGER_ID_ATTRIBUTE);
}
}
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
index b2b22a7e7..1a9cc76de 100644
--- 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
@@ -184,12 +184,12 @@ final public class TeamPlugin extends Plugin {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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 aliasId = configElements[j].getAttribute("canImportId"); //$NON-NLS-1$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String aliasId = configElement.getAttribute("canImportId"); //$NON-NLS-1$
if (aliasId != null && aliasId.equals(id)) {
- String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
if (extensionId != null) {
return RepositoryProviderType.getProviderType(extensionId);
}
@@ -204,11 +204,11 @@ final public class TeamPlugin extends Plugin {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, 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$
- String metaFilePaths = configElements[j].getAttribute("metaFilePaths"); //$NON-NLS-1$
+ for (IExtension ext : extensions) {
+ IConfigurationElement[] configElements = ext.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String extensionId = configElement.getAttribute("id"); //$NON-NLS-1$
+ String metaFilePaths = configElement.getAttribute("metaFilePaths"); //$NON-NLS-1$
if (extensionId != null && extensionId.equals(id) && metaFilePaths != null) {
return getPaths(metaFilePaths);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
index 6465386ba..39ce85a7a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
@@ -16,7 +16,6 @@ package org.eclipse.team.internal.core;
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;
@@ -45,8 +44,7 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
static {
metaFilePaths = new HashMap<>();
String[] ids = RepositoryProvider.getAllProviderTypeIds();
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
+ for (String id : ids) {
IPath[] paths = TeamPlugin.getMetaFilePaths(id);
if (paths != null) {
metaFilePaths.put(id, paths);
@@ -57,8 +55,7 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta[] projectDeltas = event.getDelta().getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta delta = projectDeltas[i];
+ for (IResourceDelta delta : projectDeltas) {
IResource resource = delta.getResource();
IProject project = resource.getProject();
if (!RepositoryProvider.isShared(project)) {
@@ -85,8 +82,7 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
Set<IContainer> metaFileContainers = new HashSet<>();
Set<String> badIds = new HashSet<>();
IFile[] files = getAddedFiles(delta);
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
String typeId = getMetaFileType(file);
if (typeId != null) {
// The file path matches the path for the given type id
@@ -112,8 +108,7 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
IPath[] paths = metaFilePaths.get(typeId);
IPath foundPath = null;
IPath projectRelativePath = file.getProjectRelativePath();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
if (isSuffix(projectRelativePath, path)) {
foundPath = path;
}
@@ -131,11 +126,9 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
}
private String getMetaFileType(IFile file) {
- for (Iterator<String> iter = metaFilePaths.keySet().iterator(); iter.hasNext();) {
- String id = iter.next();
+ for (String id : metaFilePaths.keySet()) {
IPath[] paths = metaFilePaths.get(id);
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
if (isSuffix(file.getProjectRelativePath(), path)) {
return id;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java
index d363481cc..3e90f2eb1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java
@@ -47,15 +47,16 @@ public class LocalFileHistory extends FileHistory {
//the predecessor is the file with a timestamp that is the largest timestamp
//from the set of all timestamps smaller than the root file's timestamp
IFileRevision fileRevision = null;
- for (int i = 0; i < revisions.length; i++) {
- if (((LocalFileRevision) revisions[i]).isPredecessorOf(revision)) {
+ for (IFileRevision r : revisions) {
+ if (((LocalFileRevision) r).isPredecessorOf(revision)) {
//no revision has been set as of yet
- if (fileRevision == null)
- fileRevision = revisions[i];
+ if (fileRevision == null) {
+ fileRevision = r;
+ }
//this revision is a predecessor - now check to see if it comes
//after the current predecessor, if it does make it the current predecessor
- if (fileRevision != null && revisions[i].getTimestamp() > fileRevision.getTimestamp()) {
- fileRevision = revisions[i];
+ if (fileRevision != null && r.getTimestamp() > fileRevision.getTimestamp()) {
+ fileRevision = r;
}
}
}
@@ -67,8 +68,7 @@ public class LocalFileHistory extends FileHistory {
@Override
public IFileRevision getFileRevision(String id) {
if (revisions != null) {
- for (int i = 0; i < revisions.length; i++) {
- IFileRevision revision = revisions[i];
+ for (IFileRevision revision : revisions) {
if (revision.getContentIdentifier().equals(id)) {
return revision;
}
@@ -89,9 +89,9 @@ public class LocalFileHistory extends FileHistory {
IFileRevision[] revisions = getFileRevisions();
ArrayList<IFileRevision> directDescendents = new ArrayList<>();
- for (int i = 0; i < revisions.length; i++) {
- if (((LocalFileRevision) revisions[i]).isDescendentOf(revision)) {
- directDescendents.add(revisions[i]);
+ for (IFileRevision r : revisions) {
+ if (((LocalFileRevision) r).isDescendentOf(revision)) {
+ directDescendents.add(r);
}
}
return directDescendents.toArray(new IFileRevision[directDescendents.size()]);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
index 1937f93f8..7a0de8202 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
@@ -73,8 +73,8 @@ public class BundleImporterExtension implements IBundleImporter {
if (supportedValues == null) {
IConfigurationElement[] supported = element.getChildren("supports"); //$NON-NLS-1$
supportedValues = new HashSet<>(supported.length);
- for (int i = 0; i < supported.length; i++) {
- supportedValues.add(supported[i].getAttribute("prefix")); //$NON-NLS-1$
+ for (IConfigurationElement s : supported) {
+ supportedValues.add(s.getAttribute("prefix")); //$NON-NLS-1$
}
}
return supportedValues;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java
index a5a584907..3784d1e8f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java
@@ -29,8 +29,7 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati
@Override
public ResourceMapping getMapping(Object modelObject) {
ResourceMapping[] mappings = getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
if (mapping.getModelObject().equals(modelObject))
return mapping;
}
@@ -41,8 +40,7 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati
public ResourceMapping[] getMappings(String id) {
Set<ResourceMapping> result = new HashSet<>();
ResourceMapping[] mappings = getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
if (mapping.getModelProviderId().equals(id)) {
result.add(mapping);
}
@@ -55,8 +53,7 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati
public ResourceTraversal[] getTraversals(String modelProviderId) {
ResourceMapping[] mappings = getMappings(modelProviderId);
CompoundResourceTraversal traversal = new CompoundResourceTraversal();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] traversals = getTraversals(mapping);
if (traversals != null)
traversal.addTraversals(traversals);
@@ -68,8 +65,7 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati
public ModelProvider[] getModelProviders() {
Set<ModelProvider> result = new HashSet<>();
ResourceMapping[] mappings = getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ModelProvider modelProvider = mapping.getModelProvider();
if (modelProvider != null)
result.add(modelProvider);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java
index 2d68ae9dd..d8e0ccf2f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java
@@ -36,16 +36,14 @@ public class CompoundResourceTraversal {
private Set<IResource> files = new HashSet<>();
public synchronized void addTraversals(ResourceTraversal[] traversals) {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
addTraversal(traversal);
}
}
public synchronized void addTraversal(ResourceTraversal traversal) {
IResource[] resources = traversal.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
addResource(resource, traversal.getDepth());
}
}
@@ -175,8 +173,7 @@ public class CompoundResourceTraversal {
}
public synchronized void addResources(IResource[] resources, int depth) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
addResource(resource, depth);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java
index 24af159f1..9132666a4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java
@@ -55,8 +55,7 @@ public class ModelProviderResourceMapping extends ResourceMapping {
try {
IResource[] resources = provider.getDescriptor().getMatchingResources(projects);
Set<IProject> result = new HashSet<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.isAccessible())
result.add(resource.getProject());
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java
index a9fcabc3f..549662686 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java
@@ -46,8 +46,7 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope {
public ResourceTraversal[] getTraversals() {
CompoundResourceTraversal result = new CompoundResourceTraversal();
ResourceMapping[] mappings = getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] traversals = getTraversals(mapping);
result.addTraversals(traversals);
}
@@ -64,8 +63,7 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope {
private boolean contains(ResourceMapping mapping) {
ResourceMapping[] mappings = getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping child = mappings[i];
+ for (ResourceMapping child : mappings) {
if (child.equals(mapping)) {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java
index 24073fc09..cd17a2c9b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java
@@ -69,12 +69,10 @@ public class ScopeChangeEvent {
// The number of mappings has increased so we should report the new mappings
Set<ResourceMapping> originalSet = new HashSet<>();
List<ResourceMapping> result = new ArrayList<>();
- for (int i = 0; i < originalMappings.length; i++) {
- ResourceMapping mapping = originalMappings[i];
+ for (ResourceMapping mapping : originalMappings) {
originalSet.add(mapping);
}
- for (int i = 0; i < currentMappings.length; i++) {
- ResourceMapping mapping = currentMappings[i];
+ for (ResourceMapping mapping : currentMappings) {
if (!originalSet.contains(mapping)) {
result.add(mapping);
}
@@ -84,12 +82,10 @@ public class ScopeChangeEvent {
// The number of mappings may be smaller so report the removed mappings
Set<ResourceMapping> finalSet = new HashSet<>();
List<ResourceMapping> result = new ArrayList<>();
- for (int i = 0; i < currentMappings.length; i++) {
- ResourceMapping mapping = currentMappings[i];
+ for (ResourceMapping mapping : currentMappings) {
finalSet.add(mapping);
}
- for (int i = 0; i < originalMappings.length; i++) {
- ResourceMapping mapping = originalMappings[i];
+ for (ResourceMapping mapping : originalMappings) {
if (!finalSet.contains(mapping)) {
result.add(mapping);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java
index d0c2bcf98..271a1f986 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java
@@ -65,8 +65,7 @@ public class ScopeManagerEventHandler extends BackgroundEventHandler {
throws CoreException {
if (event instanceof ResourceMappingEvent) {
ResourceMappingEvent rme = (ResourceMappingEvent) event;
- for (int i = 0; i < rme.mappings.length; i++) {
- ResourceMapping mapping = rme.mappings[i];
+ for (ResourceMapping mapping : rme.mappings) {
toRefresh.add(mapping);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java
index 18e63582f..3f7db7f07 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java
@@ -55,8 +55,7 @@ public class TextStorageMerger implements IStorageMerger {
RangeDifference[] diffs= RangeDifferencer.findRanges(monitor, a, t, o);
- for (int i= 0; i < diffs.length; i++) {
- RangeDifference rd= diffs[i];
+ for (RangeDifference rd : diffs) {
switch (rd.kind()) {
case RangeDifference.ANCESTOR: // pseudo conflict
case RangeDifference.NOCHANGE:
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java
index 1aba78078..e1f36e6bb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java
@@ -40,11 +40,9 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
public IResource[] getRoots() {
List<IResource> result = new ArrayList<>();
ResourceTraversal[] traversals = getTraversals();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ for (IResource resource : resources) {
accumulateRoots(result, resource);
}
}
@@ -54,8 +52,7 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
@Override
public boolean contains(IResource resource) {
ResourceTraversal[] traversals = getTraversals();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
if (traversal.contains(resource))
return true;
}
@@ -89,8 +86,7 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
*/
public void fireTraversalsChangedEvent(final ResourceTraversal[] newTraversals, final ResourceMapping[] newMappings) {
Object[] allListeners = listeners.getListeners();
- for (int i = 0; i < allListeners.length; i++) {
- final Object listener = allListeners[i];
+ for (Object listener : allListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() throws Exception {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java
index 59608f687..dcd56d931 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java
@@ -138,8 +138,7 @@ public class ActiveChangeSet extends DiffChangeSet {
if (!isEmpty()) {
StringBuilder buffer = new StringBuilder();
IResource[] resources = getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
buffer.append(resource.getFullPath().toString());
buffer.append('\n');
}
@@ -207,8 +206,7 @@ public class ActiveChangeSet extends DiffChangeSet {
*/
public void add(IResource[] resources) throws CoreException {
List<IDiff> toAdd = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff diff = getManager().getDiff(resource);
if (diff != null) {
toAdd.add(diff);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
index a5b35c1ef..307c1978d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
@@ -60,8 +60,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
*/
protected ChangeSet getChangeSet(IResourceDiffTree tree) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet changeSet = sets[i];
+ for (ChangeSet changeSet : sets) {
if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
return changeSet;
}
@@ -143,8 +142,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
*/
public ActiveChangeSet getSet(String name) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set.getName().equals(name) && set instanceof ActiveChangeSet) {
return (ActiveChangeSet)set;
}
@@ -162,8 +160,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
*/
public ActiveChangeSet createSet(String title, IFile[] files) throws CoreException {
List<IDiff> infos = new ArrayList<>();
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
IDiff diff = getDiff(file);
if (diff != null) {
infos.add(diff);
@@ -214,18 +211,15 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
private IPath[] getAllResources(IDiffChangeEvent event) {
Set<IPath> allResources = new HashSet<>();
IDiff[] addedResources = event.getAdditions();
- for (int i = 0; i < addedResources.length; i++) {
- IDiff diff = addedResources[i];
+ for (IDiff diff : addedResources) {
allResources.add(diff.getPath());
}
IDiff[] changedResources = event.getChanges();
- for (int i = 0; i < changedResources.length; i++) {
- IDiff diff = changedResources[i];
+ for (IDiff diff : changedResources) {
allResources.add(diff.getPath());
}
IPath[] removals = event.getRemovals();
- for (int i = 0; i < removals.length; i++) {
- IPath path = removals[i];
+ for (IPath path : removals) {
allResources.add(path);
}
return allResources.toArray(new IPath[allResources.size()]);
@@ -244,8 +238,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
}
// Remove the added files from any other set that contains them
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet otherSet = sets[i];
+ for (ChangeSet otherSet : sets) {
if (otherSet != set && ((ActiveChangeSet)otherSet).isUserCreated()) {
otherSet.remove(resources);
}
@@ -309,8 +302,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
CompoundResourceTraversal traversal = new CompoundResourceTraversal();
traversal.addTraversals(traversals);
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
handleIntersect(traversal, set);
}
return traversal.asTraversals();
@@ -318,8 +310,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
private void handleIntersect(CompoundResourceTraversal traversal, ChangeSet set) {
IResource[] resources = set.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (traversal.isCovered(resource, IResource.DEPTH_ZERO)) {
traversal.addResources(resources, IResource.DEPTH_ZERO);
return;
@@ -339,16 +330,14 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
// Clear the persisted state before saving the new state
try {
String[] oldSetNames = prefs.childrenNames();
- for (int i = 0; i < oldSetNames.length; i++) {
- String string = oldSetNames[i];
+ for (String string : oldSetNames) {
prefs.node(string).removeNode();
}
} catch (BackingStoreException e) {
TeamPlugin.log(IStatus.ERROR, NLS.bind(Messages.SubscriberChangeSetCollector_5, new String[] { getName() }), e);
}
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set instanceof ActiveChangeSet && !set.isEmpty()) {
// Since the change set title is stored explicitly, the name of
// the child preference node doesn't matter as long as it
@@ -408,8 +397,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
String defaultSetTitle = prefs.get(CTX_DEFAULT_SET, null);
try {
String[] childNames = prefs.childrenNames();
- for (int i = 0; i < childNames.length; i++) {
- String string = childNames[i];
+ for (String string : childNames) {
Preferences childPrefs = prefs.node(string);
ActiveChangeSet set = createSet(childPrefs);
if (!set.isEmpty()) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java
index f94fd8972..cd4ad4d80 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java
@@ -64,12 +64,10 @@ public class BatchingChangeSetManager extends ChangeSetManager {
changed.put(changeSet, allAffectedResources);
} else {
Set<IPath> allPaths = new HashSet<>();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
allPaths.add(path);
}
- for (int i = 0; i < allAffectedResources.length; i++) {
- IPath path = allAffectedResources[i];
+ for (IPath path : allAffectedResources) {
allPaths.add(path);
}
changed.put(changeSet, allPaths.toArray(new IPath[allPaths.size()]));
@@ -130,8 +128,8 @@ public class BatchingChangeSetManager extends ChangeSetManager {
final CollectorChangeEvent event = changes;
changes = new CollectorChangeEvent(this);
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
if (listener instanceof IChangeSetCollectorChangeListener) {
final IChangeSetCollectorChangeListener csccl = (IChangeSetCollectorChangeListener) listener;
SafeRunner.run(new ISafeRunnable() {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
index 7c551b763..426710046 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
@@ -146,8 +146,7 @@ public class BatchingLock {
// Create a MultiRule for all projects from the given rule
ISchedulingRule[] rules = ((MultiRule)resourceRule).getChildren();
Set<ISchedulingRule> projects = new HashSet<>();
- for (int i = 0; i < rules.length; i++) {
- ISchedulingRule childRule = rules[i];
+ for (ISchedulingRule childRule : rules) {
if (childRule instanceof IResource) {
projects.add(((IResource)childRule).getProject());
}
@@ -255,8 +254,7 @@ public class BatchingLock {
private ThreadInfo getThreadInfo(IResource resource) {
synchronized (infos) {
- for (Iterator iter = infos.values().iterator(); iter.hasNext();) {
- ThreadInfo info = (ThreadInfo) iter.next();
+ for (ThreadInfo info : infos.values()) {
if (info.ruleContains(resource)) {
return info;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSet.java
index 03c9e2e3e..5eb583fab 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSet.java
@@ -69,8 +69,7 @@ public abstract class ChangeSet {
* @param resources the resources to be removed
*/
public void remove(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
remove(resource);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java
index ca446b0a3..1cf0e10ac 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java
@@ -49,8 +49,8 @@ public abstract class ChangeSetManager {
return;
if (contains(set)) {
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -75,8 +75,8 @@ public abstract class ChangeSetManager {
if (initializing)
return;
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -109,8 +109,8 @@ public abstract class ChangeSetManager {
if (initializing)
return;
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -143,8 +143,8 @@ public abstract class ChangeSetManager {
if (initializing)
return;
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
@@ -208,8 +208,8 @@ public abstract class ChangeSetManager {
if (initializing)
return;
Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
+ for (Object l : listeners) {
+ final IChangeSetChangeListener listener = (IChangeSetChangeListener) l;
SafeRunner.run(new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java
index 92a65d4a2..fa19cd488 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java
@@ -105,8 +105,7 @@ public abstract class CheckedInChangeSet extends ChangeSet {
public void add(SyncInfo[] infos) {
try {
set.beginInput();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
add(info);
}
} finally {
@@ -131,8 +130,7 @@ public abstract class CheckedInChangeSet extends ChangeSet {
*/
@Override
public void remove(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
remove(resource);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
index ee7fbca4c..49532b35b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
@@ -155,11 +155,10 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
IResource[] remoteMembers = getRemoteStore().members(resource);
IResource[] baseMembers = getBaseStore().members(resource);
Set<IResource> members = new HashSet<>();
- for (int i = 0; i < remoteMembers.length; i++) {
- members.add(remoteMembers[i]);
+ for (IResource remoteMember : remoteMembers) {
+ members.add(remoteMember);
}
- for (int i = 0; i < baseMembers.length; i++) {
- IResource member = baseMembers[i];
+ for (IResource member : baseMembers) {
// Add the base only if the remote does not know about it
// (i.e. hasn't marked it as deleted
if (!isVariantKnown(member)) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java
index cfb3a92e1..12068ac78 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java
@@ -101,8 +101,7 @@ public class DiffChangeSet extends ChangeSet {
public void add(IDiff[] diffs) {
try {
tree.beginInput();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
add(diff);
}
} finally {
@@ -133,8 +132,7 @@ public class DiffChangeSet extends ChangeSet {
if (diffs.length > 0) {
try {
tree.beginInput();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
IResource r = tree.getResource(diff);
if (r != null)
tree.remove(r);
@@ -157,8 +155,7 @@ public class DiffChangeSet extends ChangeSet {
public void remove(IPath[] paths) {
try {
tree.beginInput();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
tree.remove(path);
}
} finally {
@@ -170,8 +167,7 @@ public class DiffChangeSet extends ChangeSet {
public void remove(IResource[] resources) {
try {
tree.beginInput();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
tree.remove(resource);
}
} finally {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
index 2fb946549..7cd58fbd0 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
@@ -107,9 +107,7 @@ public class DiffTreeStatistics {
@Override
public String toString() {
StringBuilder out = new StringBuilder();
- Iterator it = stats.keySet().iterator();
- while (it.hasNext()) {
- Integer kind = (Integer) it.next();
+ for (Integer kind : stats.keySet()) {
out.append(SyncInfo.kindToString(kind.intValue()) + ": " + stats.get(kind) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
return out.toString();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java
index 5331a4b09..e2f49e9b5 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java
@@ -64,8 +64,7 @@ public class RootResourceSynchronizationScope extends AbstractResourceMappingSco
@Override
public ResourceMapping[] getMappings() {
List<ResourceMapping> result = new ArrayList<>();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
Object o = resource.getAdapter(ResourceMapping.class);
if (o instanceof ResourceMapping) {
result.add((ResourceMapping) o);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java
index c34010237..2f6bf680d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java
@@ -15,7 +15,6 @@ package org.eclipse.team.internal.core.subscribers;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -79,8 +78,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
ResourceDiffTree[] locked = null;
try {
locked = beginDispath();
- for (Iterator iter = dispatchEvents.iterator(); iter.hasNext();) {
- Event event = (Event) iter.next();
+ for (Event event : dispatchEvents) {
switch (event.getType()) {
case RESOURCE_REMOVAL:
handleRemove(event.getResource());
@@ -115,8 +113,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
ChangeSet[] sets = getSets();
List<ResourceDiffTree> lockedSets = new ArrayList<>();
try {
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet)sets[i];
+ for (ChangeSet s : sets) {
+ ActiveChangeSet set = (ActiveChangeSet) s;
ResourceDiffTree tree = set.internalGetDiffTree();
lockedSets.add(tree);
tree.beginInput();
@@ -124,8 +122,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
return lockedSets.toArray(new ResourceDiffTree[lockedSets.size()]);
} catch (RuntimeException e) {
try {
- for (Iterator iter = lockedSets.iterator(); iter.hasNext();) {
- ResourceDiffTree tree = (ResourceDiffTree) iter.next();
+ for (ResourceDiffTree tree : lockedSets) {
try {
tree.endInput(null);
} catch (Throwable e1) {
@@ -145,8 +142,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
return;
}
monitor.beginTask(null, 100 * locked.length);
- for (int i = 0; i < locked.length; i++) {
- ResourceDiffTree tree = locked[i];
+ for (ResourceDiffTree tree : locked) {
try {
tree.endInput(Policy.subMonitorFor(monitor, 100));
} catch (RuntimeException e) {
@@ -170,8 +166,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
*/
private void handleRemove(IResource resource) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
// This will remove any descendants from the set and callback to
// resourcesChanged which will batch changes
if (!set.isEmpty()) {
@@ -197,8 +192,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
getDefaultSet().add(diff);
}
} else {
- for (int i = 0; i < containingSets.length; i++) {
- ActiveChangeSet set = containingSets[i];
+ for (ActiveChangeSet set : containingSets) {
// Update the sync info in the set
set.add(diff);
}
@@ -208,8 +202,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
}
if (depth != IResource.DEPTH_ZERO) {
IResource[] members = getSubscriber().members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
handleChange(member, depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE);
}
}
@@ -218,8 +211,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
private void removeFromAllSets(IResource resource) {
List<ChangeSet> toRemove = new ArrayList<>();
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set.contains(resource)) {
set.remove(resource);
if (set.isEmpty()) {
@@ -236,8 +228,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
private ActiveChangeSet[] getContainingSets(IResource resource) {
Set<ActiveChangeSet> result = new HashSet<>();
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set.contains(resource)) {
result.add((ActiveChangeSet) set);
}
@@ -282,8 +273,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
public boolean hasMembers(IResource resource) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet)sets[i];
+ for (ChangeSet s : sets) {
+ ActiveChangeSet set = (ActiveChangeSet) s;
if (set.getDiffTree().getChildren(resource.getFullPath()).length > 0)
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
index 4fbe86525..576842e3c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
@@ -206,8 +206,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
IProgressMonitor monitor) {
try {
tree.beginInput();
- for (int i = 0; i < events.length; i++) {
- SubscriberEvent event = events[i];
+ for (SubscriberEvent event : events) {
switch (event.getType()) {
case SubscriberEvent.CHANGE :
if (event instanceof SubscriberDiffChangedEvent) {
@@ -220,10 +219,9 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
}
}
break;
- case SubscriberEvent.REMOVAL :
+ case SubscriberEvent.REMOVAL:
IDiff[] nodesToRemove = tree.getDiffs(new ResourceTraversal[] { event.asTraversal() });
- for (int j = 0; j < nodesToRemove.length; j++) {
- IDiff node = nodesToRemove[j];
+ for (IDiff node : nodesToRemove) {
tree.remove(node.getPath());
}
break;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
index 94e2495a4..050a0eae6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
@@ -199,13 +199,10 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
try {
IResource[] members =
getSubscriber().members(resource);
- for (int i = 0; i < members.length; i++) {
- collect(
- members[i],
- depth == IResource.DEPTH_INFINITE
+ for (IResource member : members) {
+ collect(member, depth == IResource.DEPTH_INFINITE
? IResource.DEPTH_INFINITE
- : IResource.DEPTH_ZERO,
- monitor);
+ : IResource.DEPTH_ZERO, monitor);
}
} catch (TeamException e) {
// We only handle the exception if the resource's project is accessible.
@@ -286,11 +283,10 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
* optimized recalculation if supported by the subscriber.
*/
protected void reset(ResourceTraversal[] traversals, int type) {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- queueEvent(new SubscriberEvent(resources[j], type, traversal.getDepth()), false);
+ for (IResource resource : resources) {
+ queueEvent(new SubscriberEvent(resource, type, traversal.getDepth()), false);
}
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
index 04b85e69f..78d9e4730 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
@@ -68,19 +68,19 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
try {
beginInput();
IResource[] roots = getRoots();
- for (int i = 0; i < deltas.length; i++) {
- switch (deltas[i].getFlags()) {
- case ISubscriberChangeEvent.SYNC_CHANGED :
- if (isAllRootsIncluded() || isDescendantOfRoot(deltas[i].getResource(), roots)) {
- change(deltas[i].getResource(), IResource.DEPTH_ZERO);
+ for (ISubscriberChangeEvent delta : deltas) {
+ switch (delta.getFlags()) {
+ case ISubscriberChangeEvent.SYNC_CHANGED:
+ if (isAllRootsIncluded() || isDescendantOfRoot(delta.getResource(), roots)) {
+ change(delta.getResource(), IResource.DEPTH_ZERO);
}
break;
- case ISubscriberChangeEvent.ROOT_REMOVED :
- remove(deltas[i].getResource());
+ case ISubscriberChangeEvent.ROOT_REMOVED:
+ remove(delta.getResource());
break;
- case ISubscriberChangeEvent.ROOT_ADDED :
- if (isAllRootsIncluded() || isDescendantOfRoot(deltas[i].getResource(), roots)) {
- change(deltas[i].getResource(), IResource.DEPTH_INFINITE);
+ case ISubscriberChangeEvent.ROOT_ADDED:
+ if (isAllRootsIncluded() || isDescendantOfRoot(delta.getResource(), roots)) {
+ change(delta.getResource(), IResource.DEPTH_INFINITE);
}
break;
}
@@ -168,8 +168,8 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
// Handle changed children
if (visitChildren || isAncestorOfRoot(resource, roots)) {
IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED | IResourceDelta.ADDED);
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i], roots);
+ for (IResourceDelta c : affectedChildren) {
+ processDelta(c, roots);
}
}
}
@@ -222,8 +222,7 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
private boolean isAncestorOfRoot(IResource parent, IResource[] roots) {
// Always traverse into projects in case a root was removed
if (parent.getType() == IResource.ROOT) return true;
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
if (parent.getFullPath().isPrefixOf(resource.getFullPath())) {
return true;
}
@@ -232,8 +231,7 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
}
private boolean isDescendantOfRoot(IResource resource, IResource[] roots) {
- for (int i = 0; i < roots.length; i++) {
- IResource root = roots[i];
+ for (IResource root : roots) {
if (root.getFullPath().isPrefixOf(resource.getFullPath())) {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java
index 72379bb7c..9bfb1d862 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java
@@ -181,8 +181,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
SubscriberSyncInfoSet syncSet = syncSetInput.getSyncSet();
try {
syncSet.beginInput();
- for (int i = 0; i < events.length; i++) {
- SubscriberEvent event = events[i];
+ for (SubscriberEvent event : events) {
switch (event.getType()) {
case SubscriberEvent.CHANGE :
if (event instanceof SubscriberSyncInfoEvent) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncByteConverter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncByteConverter.java
index a627e32b7..d6c585941 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncByteConverter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncByteConverter.java
@@ -123,8 +123,7 @@ public class SyncByteConverter {
public static byte[] toBytes(String[] slots) {
StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < slots.length; i++) {
- String string = slots[i];
+ for (String string : slots) {
buffer.append(string);
buffer.append(new String(new byte[] {SyncByteConverter.SEPARATOR_BYTE }));
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
index 25e615197..5876de23d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
@@ -101,9 +101,7 @@ public class SyncInfoStatistics {
@Override
public String toString() {
StringBuilder out = new StringBuilder();
- Iterator it = stats.keySet().iterator();
- while (it.hasNext()) {
- Integer kind = (Integer) it.next();
+ for (Integer kind : stats.keySet()) {
out.append(SyncInfo.kindToString(kind.intValue()) + ": " + stats.get(kind) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
return out.toString();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
index ff232a323..18e8d22dc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
@@ -46,8 +46,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
private boolean isIncluded(IResource resource) {
// otherwise, if their is a parent of the resource in the set,
// it is included
- for (int i = 0; i < resources.length; i++) {
- IResource setResource = resources[i];
+ for (IResource setResource : resources) {
if (isParent(setResource, resource)) {
return true;
}
@@ -65,8 +64,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
// filter the roots by the selected working set
Set<IResource> result = new HashSet<>();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
result.addAll(Arrays.asList(getIntersectionWithSet(subscriber, resource)));
}
return result.toArray(new IResource[result.size()]);
@@ -78,8 +76,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
*/
private IResource[] getIntersectionWithSet(Subscriber subscriber, IResource resource) {
List<IResource> result = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource setResource = resources[i];
+ for (IResource setResource : resources) {
if (setResource != null) {
if (isParent(resource, setResource)) {
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
index 1ec6e245a..9aa0adf79 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
@@ -46,8 +46,8 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
protected void fetchInput(IProgressMonitor monitor) {
if (inputSyncSet == null) return;
SyncInfo[] infos = inputSyncSet.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- collect(infos[i], monitor);
+ for (SyncInfo info : infos) {
+ collect(info, monitor);
}
}
@@ -66,14 +66,14 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
}
private void syncSetChanged(SyncInfo[] infos, IProgressMonitor monitor) {
- for (int i = 0; i < infos.length; i++) {
- collect(infos[i], monitor);
+ for (SyncInfo info : infos) {
+ collect(info, monitor);
}
}
private void remove(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- remove(resources[i]);
+ for (IResource resource : resources) {
+ remove(resource);
}
}
@@ -104,8 +104,7 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
SubscriberSyncInfoSet syncSet = getSyncSet();
try {
syncSet.beginInput();
- for (int i = 0; i < errors.length; i++) {
- ITeamStatus status = errors[i];
+ for (ITeamStatus status : errors) {
syncSet.addError(status);
}
} finally {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
index 2df39fdfa..00a84652b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -61,8 +61,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
public void resetRoots(IResource[] resources, CVSTag[] tags) {
if (this.resources != null) {
List removed = new ArrayList();
- for (int i = 0; i < this.resources.length; i++) {
- IResource resource = this.resources[i];
+ for (IResource resource : this.resources) {
removed.add(new SubscriberChangeEvent(this, ISubscriberChangeEvent.ROOT_REMOVED, resource));
}
this.resources = new IResource[0];
@@ -118,8 +117,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
@Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
List outgoingDeltas = new ArrayList(deltas.length);
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
+ for (ISubscriberChangeEvent delta : deltas) {
if ((delta.getFlags() & ISubscriberChangeEvent.ROOT_REMOVED) != 0) {
IResource resource = delta.getResource();
outgoingDeltas.addAll(Arrays.asList(handleRemovedRoot(resource)));
@@ -142,8 +140,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
private SubscriberChangeEvent[] handleRemovedRoot(IResource removedRoot) {
// Determine if any of the roots of the compare are affected
List removals = new ArrayList(resources.length);
- for (int j = 0; j < resources.length; j++) {
- IResource root = resources[j];
+ for (IResource root : resources) {
if (removedRoot.getFullPath().isPrefixOf(root.getFullPath())) {
// The root is no longer managed by CVS
removals.add(root);
@@ -180,8 +177,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
return false;
}
if (this.resources != null) {
- for (int i = 0; i < resources.length; i++) {
- IResource root = resources[i];
+ for (IResource root : resources) {
if (root.getFullPath().isPrefixOf(resource.getFullPath())) {
return true;
}
@@ -221,8 +217,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
*
*/
public void primeRemoteTree() throws CVSException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
cvsResource.accept(new ICVSResourceVisitor() {
public void visitFile(ICVSFile file) throws CVSException {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java
index cc2be829e..ddfede413 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java
@@ -140,8 +140,7 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator
}
protected IStatus setWritable(final IFile[] files) {
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
ResourceAttributes attributes = file.getResourceAttributes();
if (attributes != null) {
attributes.setReadOnly(false);
@@ -157,8 +156,7 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator
private IFile[] getManagedReadOnlyFiles(IFile[] files) {
List readOnlys = new ArrayList();
- for (int i = 0; i < files.length; i++) {
- IFile iFile = files[i];
+ for (IFile iFile : files) {
if (needsCheckout(iFile)) {
readOnlys.add(iFile);
}
@@ -168,8 +166,7 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator
protected IFile[] getUnmanagedReadOnlyFiles(IFile[] files) {
List readOnlys = new ArrayList();
- for (int i = 0; i < files.length; i++) {
- IFile iFile = files[i];
+ for (IFile iFile : files) {
if (iFile.isReadOnly() && !needsCheckout(iFile)) {
readOnlys.add(iFile);
}
@@ -213,9 +210,11 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator
return isReadOnly(resources[0]) ? factory.getParent(resources[0]) : null;
//need a lock on the parents of all read-only files
HashSet rules = new HashSet();
- for (int i = 0; i < resources.length; i++)
- if (isReadOnly(resources[i]))
- rules.add(factory.getParent(resources[i]));
+ for (IResource resource : resources) {
+ if (isReadOnly(resource)) {
+ rules.add(factory.getParent(resource));
+ }
+ }
return createSchedulingRule(rules);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index 5f38acc26..68e834b79 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -58,8 +58,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
// Only refresh the base of a resource once as it should not change
List unrefreshed = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (!hasResourceVariant(resource)) {
unrefreshed.add(resource);
}
@@ -172,8 +171,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
}
public void merged(IResource[] resources) throws TeamException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
internalMerged(resource);
}
fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, resources));
@@ -279,8 +277,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
* @see org.eclipse.team.core.subscribers.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.subscribers.TeamDelta[])
*/
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
+ for (ISubscriberChangeEvent delta : deltas) {
switch(delta.getFlags()) {
case ISubscriberChangeEvent.ROOT_REMOVED:
IResource resource = delta.getResource();
@@ -317,8 +314,7 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
SyncInfoFilter.ContentComparisonSyncInfoFilter contentFilter =
new SyncInfoFilter.ContentComparisonSyncInfoFilter();
monitor.beginTask(null, refreshed.length * 100);
- for (int i = 0; i < refreshed.length; i++) {
- IResource resource = refreshed[i];
+ for (IResource resource : refreshed) {
if (resource.getType() == IResource.FILE) {
ICVSFile local = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
byte[] localBytes = local.getSyncBytes();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
index 494172dac..276a7fbab 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
@@ -221,8 +221,8 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
*/
public static IProject[] asProjects(String[] referenceStrings, Map infoMap) throws CVSException {
Collection result = new ArrayList();
- for (int i = 0; i < referenceStrings.length; i++) {
- StringTokenizer tokenizer = new StringTokenizer(referenceStrings[i], ","); //$NON-NLS-1$
+ for (String referenceString : referenceStrings) {
+ StringTokenizer tokenizer = new StringTokenizer(referenceString, ","); //$NON-NLS-1$
String version = tokenizer.nextToken();
// If this is a newer version, then ignore it
if (!version.equals("1.0")) //$NON-NLS-1$
@@ -351,10 +351,9 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
if (useKnown && (newLocation.getUsername() == null || newLocation.getUsername().length() == 0)) {
// look for an existing location that matches
ICVSRepositoryLocation[] locations = CVSProviderPlugin.getPlugin().getKnownRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
+ for (ICVSRepositoryLocation location : locations) {
if (CVSRepositoryLocationMatcher.isMatching(newLocation, location))
- return location;
+ return location;
}
}
if (addIfNotFound)
@@ -520,8 +519,8 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[0]);
} else {
Set rules = new HashSet();
- for (int i = 0; i < projects.length; i++) {
- ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[i]);
+ for (IProject project : projects) {
+ ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project);
if (modifyRule instanceof IResource && ((IResource)modifyRule).getType() == IResource.ROOT) {
// One of the projects is mapped to a provider that locks the workspace.
// Just return the workspace root rule
@@ -538,8 +537,7 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
/* internal use only */ static void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException, TeamException {
monitor.beginTask(CVSMessages.CVSProvider_Creating_projects_2, projects.length * 100);
try {
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
// Register the project with Team
RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
@@ -561,8 +559,7 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
}
monitor.beginTask(CVSMessages.CVSProvider_Scrubbing_projects_1, projects.length * 100);
try {
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
if (project != null && project.exists()) {
if(!project.isOpen()) {
project.open(Policy.subMonitorFor(monitor, 10));
@@ -577,9 +574,9 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 80);
subMonitor.beginTask(null, children.length * 100);
try {
- for (int j = 0; j < children.length; j++) {
- if ( ! children[j].getName().equals(".project")) {//$NON-NLS-1$
- children[j].delete(true /*force*/, Policy.subMonitorFor(subMonitor, 100));
+ for (IResource c : children) {
+ if (!c.getName().equals(".project")) { //$NON-NLS-1$
+ c.delete(true /*force*/, Policy.subMonitorFor(subMonitor, 100));
}
}
} finally {
@@ -606,8 +603,8 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
if(fileList == null) {
throw new CVSException("Content from directory '" + resource.getAbsolutePath() + "' can not be listed."); //$NON-NLS-1$ //$NON-NLS-2$
}
- for (int i = 0; i < fileList.length; i++) {
- deepDelete(fileList[i]);
+ for (File f : fileList) {
+ deepDelete(f);
}
}
resource.delete();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index 7a61e6da0..70568ab3b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -429,8 +429,7 @@ public class CVSProviderPlugin extends Plugin {
synchronized(decoratorEnablementListeners) {
listeners = (ICVSDecoratorEnablementListener[]) decoratorEnablementListeners.toArray(new ICVSDecoratorEnablementListener[decoratorEnablementListeners.size()]);
}
- for (int i = 0; i < listeners.length; i++) {
- final ICVSDecoratorEnablementListener listener = listeners[i];
+ for (ICVSDecoratorEnablementListener listener : listeners) {
ISafeRunnable code = new ISafeRunnable() {
public void run() throws Exception {
listener.decoratorEnablementChanged(enabled);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
index ac05beb4f..e2357f1ad 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
@@ -128,8 +128,7 @@ public class CVSStatus extends TeamStatus {
}
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus child = children[i];
+ for (IStatus child : children) {
if (isInternalError(child)) {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
index af043f38c..dffed25ae 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java
@@ -369,10 +369,10 @@ public class CVSSyncInfo extends SyncInfo {
if (entries == null || entries.length == 0)
return null;
- for (int i = 0; i < entries.length; i++) {
+ for (ILogEntry entry : entries) {
try {
- if (localRevision.equals(entries[i].getRemoteFile().getRevision())) {
- return entries[i].getAuthor();
+ if (localRevision.equals(entry.getRemoteFile().getRevision())) {
+ return entry.getAuthor();
}
} catch (TeamException e) {
CVSProviderPlugin.log(e);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 0e738abf8..417b222d9 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -196,9 +196,9 @@ public class CVSTeamProvider extends RepositoryProvider {
*/
private String[] getValidArguments(IResource[] resources, LocalOption[] options) throws CVSException {
List arguments = new ArrayList(resources.length);
- for (int i=0;i<resources.length;i++) {
- checkIsChild(resources[i]);
- IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
+ for (IResource resource : resources) {
+ checkIsChild(resource);
+ IPath cvsPath = resource.getFullPath().removeFirstSegments(1);
if (cvsPath.segmentCount() == 0) {
arguments.add(Session.CURRENT_LOCAL_FOLDER);
} else {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
index 7e3573456..1d8cd8062 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
@@ -153,8 +153,7 @@ public class CVSTeamProviderType extends RepositoryProviderType implements IAdap
@Override
public void metaFilesDetected(IProject project, IContainer[] containers) {
- for (int i = 0; i < containers.length; i++) {
- IContainer container = containers[i];
+ for (IContainer container : containers) {
IContainer cvsDir = null;
if (container.getName().equals("CVS")) { //$NON-NLS-1$
cvsDir = container;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index 004ccb559..dfbabc211 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -85,8 +85,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
public IResource[] roots() {
List result = new ArrayList();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
if(project.isOpen()) {
RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
if(provider != null) {
@@ -161,8 +160,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
@Override
public void collectOutOfSync(IResource[] resources, int depth, final SyncInfoSet set, final IProgressMonitor monitor) {
monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
try {
if (!isSupervised(resource)) {
return;
@@ -206,8 +204,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
boolean keepGoing = visitor.visit(resource);
if (keepGoing && depth != IResource.DEPTH_ZERO) {
IResource[] members = members(resource);
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
visit(member, visitor, depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE);
}
}
@@ -306,11 +303,9 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
private int getOutgoingKind(ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
int kind = 0;
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ for (IResource resource : resources) {
IDiff node = getDiff(resource);
if (node == null)
return IDiff.CHANGE;
@@ -329,41 +324,35 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
*/
public boolean hasLocalChanges(ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
switch (traversal.getDepth()) {
- case IResource.DEPTH_ZERO:
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- if (isDirectlyDirty(resource, monitor)) {
- return true;
- }
- }
- break;
- case IResource.DEPTH_INFINITE:
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- if (isDirty(resource, monitor)) {
- return true;
+ case IResource.DEPTH_ZERO:
+ for (IResource resource : resources) {
+ if (isDirectlyDirty(resource, monitor)) {
+ return true;
+ }
}
- }
- break;
- case IResource.DEPTH_ONE:
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- if (isDirectlyDirty(resource, monitor)) {
- return true;
+ break;
+ case IResource.DEPTH_INFINITE:
+ for (IResource resource : resources) {
+ if (isDirty(resource, monitor)) {
+ return true;
+ }
}
- IResource[] children = members(resource);
- for (int k = 0; k < children.length; k++) {
- IResource child = children[k];
- if (isDirectlyDirty(child, monitor)) {
+ break;
+ case IResource.DEPTH_ONE:
+ for (IResource resource : resources) {
+ if (isDirectlyDirty(resource, monitor)) {
return true;
+ } IResource[] children = members(resource);
+ for (IResource child : children) {
+ if (isDirectlyDirty(child, monitor)) {
+ return true;
+ }
}
}
- }
- break;
+ break;
}
}
return false;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
index 19dbdbba7..524f1af26 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
@@ -36,8 +36,8 @@ public class Add extends Command {
// Check that all the arguments can give you an
// repo that you will need while traversing the
// file-structure
- for (int i = 0; i < resources.length; i++) {
- Assert.isNotNull(resources[i].getRemoteLocation(session.getLocalRoot()));
+ for (ICVSResource resource : resources) {
+ Assert.isNotNull(resource.getRemoteLocation(session.getLocalRoot()));
}
// Get a vistor and use it on every resource we should
@@ -59,9 +59,9 @@ public class Add extends Command {
return status;
}
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].isFolder()) {
- ICVSFolder mFolder = (ICVSFolder) resources[i];
+ for (ICVSResource resource : resources) {
+ if (resource.isFolder()) {
+ ICVSFolder mFolder = (ICVSFolder) resource;
FolderSyncInfo info = mFolder.getParent().getFolderSyncInfo();
if (info == null) {
status = mergeStatus(status, new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.Add_invalidParent, new String[] { mFolder.getRelativePath(session.getLocalRoot()) })));
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
index 4b0193f9c..9571b6cd8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
@@ -85,8 +85,7 @@ public class Checkout extends Command {
// Send the information about the local workspace resources to the server
List resourcesToSend = new ArrayList(resources.length);
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
+ for (ICVSResource resource : resources) {
if (resource.exists() && resource.isFolder() && ((ICVSFolder)resource).isCVSFolder()) {
resourcesToSend.add(resource);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index fd1e907fc..36471692c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -379,13 +379,13 @@ public abstract class Command extends Request {
/*** initiate command ***/
// send global options
- for (int i = 0; i < globalOptions.length; i++) {
- globalOptions[i].send(session);
+ for (GlobalOption globalOption : globalOptions) {
+ globalOption.send(session);
}
Policy.checkCanceled(monitor);
// send local options
- for (int i = 0; i < localOptions.length; i++) {
- localOptions[i].send(session);
+ for (LocalOption localOption : localOptions) {
+ localOption.send(session);
}
Policy.checkCanceled(monitor);
// compute the work resources
@@ -574,8 +574,7 @@ public abstract class Command extends Request {
return options;
}
List result = new ArrayList();
- for (int i = 0; i < options.length; i++) {
- Command.LocalOption option = options[i];
+ for (LocalOption option : options) {
if (!option.equals(this)) {
result.add(option);
}
@@ -808,8 +807,8 @@ public abstract class Command extends Request {
protected String[] convertArgumentsForOpenSession(ICVSResource[] arguments, Session openSession) throws CVSException {
// Convert arguments
List stringArguments = new ArrayList(arguments.length);
- for (int i = 0; i < arguments.length; i++) {
- stringArguments.add(arguments[i].getRelativePath(openSession.getLocalRoot()));
+ for (ICVSResource argument : arguments) {
+ stringArguments.add(argument.getRelativePath(openSession.getLocalRoot()));
}
return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
index 2980cd5f9..6c76478d3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
@@ -54,9 +54,9 @@ public class Commit extends Command {
// Send the changed files as arguments (because this is what other cvs clients do)
ICVSFile[] changedFiles = visitor.getModifiedFiles();
- for (int i = 0; i < changedFiles.length; i++) {
+ for (ICVSFile changedFile : changedFiles) {
// escape file names, see bug 149683
- String fileName = changedFiles[i].getRelativePath(session.getLocalRoot());
+ String fileName = changedFile.getRelativePath(session.getLocalRoot());
if(fileName.startsWith("-")){ //$NON-NLS-1$
fileName = "./" + fileName; //$NON-NLS-1$
}
@@ -84,10 +84,9 @@ public class Commit extends Command {
// Reset the timestamps of any committed files that are still dirty.
// Only do so if there were no E messages from the server
if (status.isOK()) {
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
+ for (ICVSResource resource : resources) {
if (!resource.isFolder()) {
- ICVSFile cvsFile = (ICVSFile)resources[i];
+ ICVSFile cvsFile = (ICVSFile) resource;
if (cvsFile.exists() && cvsFile.isModified(null)) {
status = mergeStatus(status, clearModifiedState(cvsFile));
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java
index 7ab88ad15..c7630029b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java
@@ -60,8 +60,7 @@ public class ConsoleListeners implements IConsoleListener {
public void commandInvoked(final Session session, final String line) {
if (listeners.isEmpty()) return;
IConsoleListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsoleListener listener = listeners[i];
+ for (IConsoleListener listener : listeners) {
Platform.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// Exception logged by Platform
@@ -77,8 +76,7 @@ public class ConsoleListeners implements IConsoleListener {
public void messageLineReceived(final Session session, final String line, final IStatus status) {
if (listeners.isEmpty()) return;
IConsoleListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsoleListener listener = listeners[i];
+ for (IConsoleListener listener : listeners) {
Platform.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// Exception logged by Platform
@@ -94,8 +92,7 @@ public class ConsoleListeners implements IConsoleListener {
public void errorLineReceived(final Session session, final String line, final IStatus status) {
if (listeners.isEmpty()) return;
IConsoleListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsoleListener listener = listeners[i];
+ for (IConsoleListener listener : listeners) {
Platform.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// Exception logged by Platform
@@ -111,8 +108,7 @@ public class ConsoleListeners implements IConsoleListener {
public void commandCompleted(final Session session, final IStatus status, final Exception exception) {
if (listeners.isEmpty()) return;
IConsoleListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsoleListener listener = listeners[i];
+ for (IConsoleListener listener : listeners) {
Platform.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// Exception logged by Platform
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
index 33babbc23..dac85d110 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
@@ -48,8 +48,7 @@ public class Diff extends Command {
if (status.getCode() == CVSStatus.SERVER_ERROR) {
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus child = children[i];
+ for (IStatus child : children) {
if (child.getMessage().indexOf("[diff aborted]") != -1) { //$NON-NLS-1$
throw new CVSServerException(status);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
index f4bf92070..c8d64e84b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
@@ -83,8 +83,7 @@ class FileStructureVisitor extends AbstractStructureVisitor {
* @param children
*/
private void sendManagedFolders(ICVSResource[] children) throws CVSException {
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
if (resource.isFolder() && resource.isManaged()) {
resource.accept(this);
}
@@ -96,8 +95,7 @@ class FileStructureVisitor extends AbstractStructureVisitor {
* @param children
*/
private void sendQuestionableFolders(ICVSResource[] children) throws CVSException {
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
if (resource.isFolder() && ! resource.isManaged()) {
resource.accept(this);
}
@@ -109,8 +107,7 @@ class FileStructureVisitor extends AbstractStructureVisitor {
* @param children
*/
private void sendFiles(ICVSResource[] children) throws CVSException {
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
if (!resource.isFolder()) {
resource.accept(this);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
index c37beec4b..427fd6720 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
@@ -81,13 +81,11 @@ class ImportStructureVisitor implements ICVSResourceVisitor {
wrapMatcher = new FileNameMatcher();
- for (int i = 0; i < wrappers.length; i++) {
-
- if (!wrappers[i].contains(KEYWORD_OPTION)) {
+ for (String wrapper : wrappers) {
+ if (!wrapper.contains(KEYWORD_OPTION)) {
continue;
}
-
- StringTokenizer st = new StringTokenizer(wrappers[i]);
+ StringTokenizer st = new StringTokenizer(wrapper);
String pattern = st.nextToken();
String option = st.nextToken();
// get rid of the quotes
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
index a65ad5e92..e06a8c9b3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
@@ -51,8 +51,7 @@ public class PruneFolderVisitor implements ICVSResourceVisitor {
// Visit the resources
Set prunableParents = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource cvsResource = resources[i];
+ for (ICVSResource cvsResource : resources) {
// prune the resource and it's children when appropriate
cvsResource.accept(this);
// if the resource doesn't exists, attempt to prune it's parent
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
index 58d8f5a46..8ca5978dc 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java
@@ -51,19 +51,18 @@ public abstract class RemoteCommand extends Command {
Session openSession)
throws CVSException {
- // Convert arguments
- List stringArguments = new ArrayList(arguments.length);
- for (int i = 0; i < arguments.length; i++) {
- ICVSResource resource = arguments[i];
- String remotePath;
- if (isDefinedModule(resource)) {
- remotePath = resource.getName();
- } else {
- remotePath = resource.getRepositoryRelativePath();
-
- }
- stringArguments.add(remotePath);
+ // Convert arguments
+ List stringArguments = new ArrayList(arguments.length);
+ for (ICVSResource resource : arguments) {
+ String remotePath;
+ if (isDefinedModule(resource)) {
+ remotePath = resource.getName();
+ } else {
+ remotePath = resource.getRepositoryRelativePath();
+
}
+ stringArguments.add(remotePath);
+ }
return (String[]) stringArguments.toArray(new String[stringArguments.size()]);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
index 341ed488d..b2eddd6fa 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
@@ -178,8 +178,7 @@ public abstract class Request {
} else {
// look for particularly bad errors in the accumulated statuses
IStatus[] errors = session.getErrors();
- for (int i = 0; i < errors.length; i++) {
- IStatus s = errors[i];
+ for (IStatus s : errors) {
if (s.getCode() == CVSStatus.PROTOCOL_ERROR) {
throw new CVSServerException(status);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
index f14bfe1c0..305a2c8e8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ServerMessageLineMatcher.java
@@ -79,8 +79,7 @@ public class ServerMessageLineMatcher {
* Throw an exception if the found variables do not match the expected variables
*/
private void ensureMatches(String template, List variables, String[] expectedVariables) throws CVSException {
- for (int i = 0; i < expectedVariables.length; i++) {
- String expected = expectedVariables[i];
+ for (String expected : expectedVariables) {
if (!variables.contains(expected)) {
IStatus status = new CVSStatus(IStatus.ERROR,NLS.bind(CVSMessages.ServerMessageLineMatcher_7, new String[] { expected, template }));
throw new CVSException(status);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 5138d2cee..b9b1dd980 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -427,8 +427,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
connectionMethods.add(new PServerConnectionMethod());
} else {
IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(CVSProviderPlugin.ID, CVSProviderPlugin.PT_CONNECTIONMETHODS).getExtensions();
- for(int i=0; i<extensions.length; i++) {
- IExtension extension = extensions[i];
+ for (IExtension extension : extensions) {
IConfigurationElement[] configs = extension.getConfigurationElements();
if (configs.length == 0) {
CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("Connection method {0} is missing required fields", new Object[] {extension.getUniqueIdentifier()}), null);//$NON-NLS-1$
@@ -456,9 +455,10 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
private static IConnectionMethod getPluggedInConnectionMethod(String methodName) {
Assert.isNotNull(methodName);
IConnectionMethod[] methods = getPluggedInConnectionMethods();
- for(int i=0; i<methods.length; i++) {
- if(methodName.equals(methods[i].getName()))
- return methods[i];
+ for (IConnectionMethod m : methods) {
+ if (methodName.equals(m.getName())) {
+ return m;
+ }
}
return null;
}
@@ -642,8 +642,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
// There is the off chance that there is a file in the root of the repository.
// This is not supported by cvs so we need to make sure there are no files
List<ICVSRemoteResource> folders = new ArrayList<ICVSRemoteResource>(resources.length);
- for (int i = 0; i < resources.length; i++) {
- ICVSRemoteResource remoteResource = resources[i];
+ for (ICVSRemoteResource remoteResource : resources) {
if (remoteResource.isContainer()) {
folders.add(remoteResource);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java
index c4b7c7b7c..baace6ca0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java
@@ -35,8 +35,8 @@ public class CVSServerException extends CVSException {
if ( ! status.isMultiStatus())
return false;
IStatus[] children = ((MultiStatus)status).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i].getCode() == CVSStatus.NO_SUCH_TAG) {
+ for (IStatus child : children) {
+ if (child.getCode() == CVSStatus.NO_SUCH_TAG) {
return true;
}
}
@@ -51,9 +51,10 @@ public class CVSServerException extends CVSException {
if ( ! status.isMultiStatus())
return status.getSeverity() == IStatus.ERROR;
IStatus[] children = ((MultiStatus)status).getChildren();
- for (int i=0;i<children.length;i++) {
- if (children[i].getSeverity() == IStatus.ERROR)
+ for (IStatus child : children) {
+ if (child.getSeverity() == IStatus.ERROR) {
return true;
+ }
}
return false;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
index 4b96051cc..18e951e3b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
@@ -122,9 +122,9 @@ public class CVSFileHistory extends FileHistory {
if (flag == IFileHistoryProvider.SINGLE_REVISION) {
String revisionNumber = cvsFile.getSyncInfo().getRevision();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revisionNumber)) {
- remoteRevisions = new IFileRevision[] {new CVSFileRevision(entries[i])};
+ for (ILogEntry entry : entries) {
+ if (entry.getRevision().equals(revisionNumber)) {
+ remoteRevisions = new IFileRevision[]{new CVSFileRevision(entry)};
revisions = new IFileRevision[1];
//copy over remote revisions
System.arraycopy(remoteRevisions, 0, revisions, 0, remoteRevisions.length);
@@ -135,19 +135,18 @@ public class CVSFileHistory extends FileHistory {
} else if (flag == IFileHistoryProvider.SINGLE_LINE_OF_DESCENT) {
CVSTag tempTag = cvsFile.getSyncInfo().getTag();
ArrayList<ILogEntry> entriesOfInterest = new ArrayList<>();
- for (int i = 0; i < entries.length; i++) {
- CVSTag[] tags = entries[i].getTags();
- for (int j = 0; j < tags.length; j++) {
- if (tags[j].getType() == tempTag.getType()) {
- if (tempTag.getType() == CVSTag.BRANCH && tempTag.getName().equals(tags[j].getName())) {
- entriesOfInterest.add(entries[i]);
+ for (ILogEntry entry : entries) {
+ CVSTag[] tags = entry.getTags();
+ for (CVSTag tag : tags) {
+ if (tag.getType() == tempTag.getType()) {
+ if (tempTag.getType() == CVSTag.BRANCH && tempTag.getName().equals(tag.getName())) {
+ entriesOfInterest.add(entry);
break;
} else {
- entriesOfInterest.add(entries[i]);
+ entriesOfInterest.add(entry);
break;
}
}
-
}
}
@@ -224,9 +223,10 @@ public class CVSFileHistory extends FileHistory {
public IFileRevision getFileRevision(String id) {
IFileRevision[] revisions = getFileRevisions();
- for (int i = 0; i < revisions.length; i++) {
- if (revisions[i].getContentIdentifier().equals(id))
- return revisions[i];
+ for (IFileRevision revision : revisions) {
+ if (revision.getContentIdentifier().equals(id)) {
+ return revision;
+ }
}
return null;
}
@@ -238,15 +238,16 @@ public class CVSFileHistory extends FileHistory {
//the predecessor is the file with a timestamp that is the largest timestamp
//from the set of all timestamps smaller than the root file's timestamp
IFileRevision fileRevision = null;
- for (int i = 0; i < revisions.length; i++) {
- if (((CVSFileRevision) revisions[i]).isPredecessorOf(revision)) {
+ for (IFileRevision r : revisions) {
+ if (((CVSFileRevision) r).isPredecessorOf(revision)) {
//no revision has been set as of yet
- if (fileRevision == null)
- fileRevision = revisions[i];
+ if (fileRevision == null) {
+ fileRevision = r;
+ }
//this revision is a predecessor - now check to see if it comes
//after the current predecessor, if it does make it the current predecessor
- if (revisions[i].getTimestamp() > fileRevision.getTimestamp()) {
- fileRevision = revisions[i];
+ if (r.getTimestamp() > fileRevision.getTimestamp()) {
+ fileRevision = r;
}
}
}
@@ -262,9 +263,9 @@ public class CVSFileHistory extends FileHistory {
//from the set of all timestamps smaller than the root file's timestamp
ArrayList<IFileRevision> directDescendents = new ArrayList<>();
- for (int i = 0; i < revisions.length; i++) {
- if (((CVSFileRevision) revisions[i]).isDescendentOf(revision)) {
- directDescendents.add(revisions[i]);
+ for (IFileRevision r : revisions) {
+ if (((CVSFileRevision) r).isDescendentOf(revision)) {
+ directDescendents.add(r);
}
}
return directDescendents.toArray(new IFileRevision[directDescendents.size()]);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileStore.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileStore.java
index 4af5b931d..688376b23 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileStore.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileStore.java
@@ -102,8 +102,7 @@ public class CVSFileStore extends FileStore {
}
ICVSResource[] children = folder.fetchChildren(monitor);
ICVSResource resource = null;
- for (int i = 0; i < children.length; i++) {
- ICVSResource child = children[i];
+ for (ICVSResource child : children) {
if (child.getName().equals(getName())) {
resource = child;
break;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileTree.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileTree.java
index 8668054bd..5cd57a811 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileTree.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileTree.java
@@ -130,8 +130,7 @@ public class CVSFileTree {
ICVSRemoteResource[] children =remoteFolder.getChildren();
ICVSResource resource = null;
- for (int i = 0; i < children.length; i++) {
- ICVSResource child = children[i];
+ for (ICVSRemoteResource child : children) {
if (child.getName().equals(resourceName)) {
resource = child;
break;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
index da89d3517..2d1832567 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSURI.java
@@ -87,15 +87,15 @@ public class CVSURI {
sb.append(ssp.substring(i + 1, j));
String[] params = ssp.substring(j).split(";"); //$NON-NLS-1$
String projectName = ""; //$NON-NLS-1$
- for (int k = 0; k < params.length; k++) {
+ for (String param : params) {
// PDE way of providing tags
- if (params[k].startsWith("tag=")) { //$NON-NLS-1$
+ if (param.startsWith("tag=")) { //$NON-NLS-1$
sb.append(",version="); //$NON-NLS-1$
- sb.append(params[k].substring(params[k].indexOf('=') + 1));
- } else if (params[k].startsWith("version=")) { //$NON-NLS-1$
- sb.append(',').append(params[k]);
- } else if (params[k].startsWith("project=")) { //$NON-NLS-1$
- projectName = params[k].substring(params[k].indexOf('=') + 1);
+ sb.append(param.substring(param.indexOf('=') + 1));
+ } else if (param.startsWith("version=")) { //$NON-NLS-1$
+ sb.append(',').append(param);
+ } else if (param.startsWith("project=")) { //$NON-NLS-1$
+ projectName = param.substring(param.indexOf('=') + 1);
}
}
sb.append(',').append(projectName); // can be ""
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/LogEntryCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/LogEntryCache.java
index 2a4803bbc..e837d78d3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/LogEntryCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/LogEntryCache.java
@@ -132,8 +132,7 @@ class LogEntryCache implements ILogEntryListener {
* Return null if the revision wasn't found.
*/
ICVSRemoteFile findRevison(ILogEntry[] allLogs, String predecessorRevision) throws TeamException {
- for (int i = 0; i < allLogs.length; i++) {
- ILogEntry entry = allLogs[i];
+ for (ILogEntry entry : allLogs) {
ICVSRemoteFile file = entry.getRemoteFile();
if (file.getRevision().equals(predecessorRevision)) {
return file;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger.java
index 06992c31a..c414f3902 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger.java
@@ -78,9 +78,8 @@ public class RemoteLogger {
String[] entry = this.cache.getCachedFilePaths();
treeBuilder = new RLogTreeBuilder(project.getRepository(), tag, cache);
- for (int i = 0; i < entry.length; i++) {
- ILogEntry[] logEntry = this.cache.getLogEntries(entry[i]);
-
+ for (String e : entry) {
+ ILogEntry[] logEntry = this.cache.getLogEntries(e);
//might not have state if this a branch entry
if (logEntry[0].getState() != null && logEntry[0].getState().equals(DEAD_STATE))
continue;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
index 7ec0c2d30..aaf674188 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetResourceMapping.java
@@ -42,8 +42,7 @@ public class ChangeSetResourceMapping extends ResourceMapping {
public IProject[] getProjects() {
Set result = new HashSet();
IResource[] resources = changeSet.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
result.add(resource.getProject());
}
return (IProject[]) result.toArray(new IProject[result.size()]);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index d15a35d64..bc5a6f626 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -50,8 +50,7 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
boolean includeIgnored = ((flags & IGNORED_MEMBERS) != 0);
boolean includeExisting = (((flags & EXISTING_MEMBERS) != 0) || ((flags & (EXISTING_MEMBERS | PHANTOM_MEMBERS)) == 0));
boolean includePhantoms = (((flags & PHANTOM_MEMBERS) != 0) || ((flags & (EXISTING_MEMBERS | PHANTOM_MEMBERS)) == 0));
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
int type = resource.getType();
if ((includeFiles && (type==IResource.FILE))
|| (includeFolders && (type==IResource.FOLDER))) {
@@ -134,12 +133,12 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
// Visit files and then folders
ICVSResource[] subFiles = members(FILE_MEMBERS);
- for (int i=0; i<subFiles.length; i++) {
- subFiles[i].accept(visitor);
+ for (ICVSResource subFile : subFiles) {
+ subFile.accept(visitor);
}
ICVSResource[] subFolders = members(FOLDER_MEMBERS);
- for (int i=0; i<subFolders.length; i++) {
- subFolders[i].accept(visitor);
+ for (ICVSResource subFolder : subFolders) {
+ subFolder.accept(visitor);
}
}
@@ -157,8 +156,8 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
} else {
resources = members(ICVSFolder.FILE_MEMBERS);
}
- for (int i = 0; i < resources.length; i++) {
- resources[i].accept(visitor, recurse);
+ for (ICVSResource r : resources) {
+ r.accept(visitor, recurse);
}
}
@@ -230,9 +229,8 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
EclipseSynchronizer.getInstance().deleteFolderSync(container);
IResource[] members = container.members(true);
- for (int i = 0; i < members.length; i++) {
+ for (IResource resource : members) {
monitor.worked(1);
- IResource resource = members[i];
if (resource.getType() == IResource.FILE) {
ResourceAttributes attrs = resource.getResourceAttributes();
if (attrs != null && attrs.isReadOnly()) {
@@ -354,8 +352,7 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
private boolean calculateAndSaveChildModificationStates(IProgressMonitor monitor) throws CVSException {
ICVSResource[] children = members(ALL_UNIGNORED_MEMBERS);
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
if (resource.isModified(null)) {
// if a child resource is dirty consider the parent dirty as well, there
// is no need to continue checking other siblings.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index fb010a389..7546634f8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -179,8 +179,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// this is done first since deleting the folder sync may remove a phantom
cacheResourceSyncForChildren(folder, true /* can modify workspace */);
IResource[] children = folder.members(true);
- for (int i = 0; i < children.length; i++) {
- IResource resource = children[i];
+ for (IResource resource : children) {
resourceChanged(resource);
// delete resource sync for all children
getSyncInfoCacheFor(resource).setCachedSyncBytes(resource, null, true);
@@ -405,8 +404,10 @@ public class EclipseSynchronizer implements IFlushOperation {
String[] ignores = SyncFileWriter.readCVSIgnoreEntries(folder);
if (ignores != null) {
// verify that the pattern has not already been added
- for (int i = 0; i < ignores.length; i++) {
- if (ignores[i].equals(pattern)) return;
+ for (String ignore : ignores) {
+ if (ignore.equals(pattern)) {
+ return;
+ }
}
// add the pattern
String[] oldIgnores = ignores;
@@ -636,8 +637,7 @@ public class EclipseSynchronizer implements IFlushOperation {
* listeners.
*/
public void ignoreFilesChanged(IContainer[] roots) throws CVSException {
- for (int i = 0; i < roots.length; i++) {
- IContainer container = roots[i];
+ for (IContainer container : roots) {
if (container.exists()) {
ISchedulingRule rule = null;
try {
@@ -661,8 +661,7 @@ public class EclipseSynchronizer implements IFlushOperation {
FileNameMatcher newIgnores = cacheFolderIgnores(container);
try {
IResource[] members = container.members();
- for (int j = 0; j < members.length; j++) {
- IResource resource = members[j];
+ for (IResource resource : members) {
if (resource.getType() == IResource.FOLDER) {
String name = resource.getName();
if (oldIgnores.match(name) && !newIgnores.match(name)) {
@@ -692,15 +691,13 @@ public class EclipseSynchronizer implements IFlushOperation {
public void syncFilesChangedExternally(IContainer[] changedMetaFiles, IFile[] externalDeletions) throws CVSException {
List<IResource> changed = new ArrayList<>();
- for (int i = 0; i < changedMetaFiles.length; i++) {
- IContainer container = changedMetaFiles[i];
+ for (IContainer container : changedMetaFiles) {
if (!isWithinActiveOperationScope(container)) {
changed.addAll(Arrays.asList(
- sessionPropertyCache.purgeCache(container, false /*don't flush children*/)));
+ sessionPropertyCache.purgeCache(container, false /*don't flush children*/)));
}
}
- for (int i = 0; i < externalDeletions.length; i++) {
- IFile file = externalDeletions[i];
+ for (IFile file : externalDeletions) {
if (!isWithinActiveOperationScope(file)) {
sessionPropertyCache.purgeCache(file.getParent(), false /*don't flush children*/);
changed.add(file);
@@ -869,8 +866,7 @@ public class EclipseSynchronizer implements IFlushOperation {
}
try {
if (infos != null) {
- for (int i = 0; i < infos.length; i++) {
- byte[] syncBytes = infos[i];
+ for (byte[] syncBytes : infos) {
IPath name = new Path(null, getName(syncBytes));
IResource resource;
if (isFolder(syncBytes)) {
@@ -924,8 +920,7 @@ public class EclipseSynchronizer implements IFlushOperation {
private byte[] getSyncBytesFromDisk(IResource resource) throws CVSException {
byte[][] infos = SyncFileWriter.readAllResourceSync(resource.getParent());
if (infos == null) return null;
- for (int i = 0; i < infos.length; i++) {
- byte[] syncBytes = infos[i];
+ for (byte[] syncBytes : infos) {
if (resource.getName().equals(getName(syncBytes))) {
return syncBytes;
}
@@ -959,8 +954,7 @@ public class EclipseSynchronizer implements IFlushOperation {
changedFolders = new IContainer[0];
}
Set<IContainer> dirtyParents = new HashSet<>();
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
+ for (IResource resource : changedResources) {
IContainer folder = resource.getParent();
dirtyParents.add(folder);
}
@@ -977,8 +971,7 @@ public class EclipseSynchronizer implements IFlushOperation {
/*** write sync info to disk ***/
// folder sync info changes
- for (int i = 0; i < changedFolders.length; i++) {
- IContainer folder = changedFolders[i];
+ for (IContainer folder : changedFolders) {
if (folder.exists() && folder.getType() != IResource.ROOT) {
try {
beginOperation();
@@ -1020,8 +1013,7 @@ public class EclipseSynchronizer implements IFlushOperation {
beginOperation();
List<byte[]> infos = new ArrayList<>();
IResource[] children = folder.members(true);
- for (int i = 0; i < children.length; i++) {
- IResource resource = children[i];
+ for (IResource resource : children) {
byte[] syncBytes = getSyncBytes(resource);
if (syncBytes != null) {
infos.add(syncBytes);
@@ -1166,8 +1158,7 @@ public class EclipseSynchronizer implements IFlushOperation {
IResource[] children = folder.members();
List<IResource> folders = new ArrayList<>();
// deal with all files first and then folders to be otimized for caching scheme
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
+ for (IResource child : children) {
if(getCachedSyncBytes(child)==null) {
possibleIgnores.add(child);
}
@@ -1205,8 +1196,7 @@ public class EclipseSynchronizer implements IFlushOperation {
infos = new NotifyInfo[] { info };
} else {
Map<String, NotifyInfo> infoMap = new HashMap<>();
- for (int i = 0; i < infos.length; i++) {
- NotifyInfo notifyInfo = infos[i];
+ for (NotifyInfo notifyInfo : infos) {
infoMap.put(notifyInfo.getName(), notifyInfo);
}
if (info == null) {
@@ -1235,8 +1225,7 @@ public class EclipseSynchronizer implements IFlushOperation {
public NotifyInfo getNotifyInfo(IResource resource) throws CVSException {
NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.getParent());
if (infos == null) return null;
- for (int i = 0; i < infos.length; i++) {
- NotifyInfo notifyInfo = infos[i];
+ for (NotifyInfo notifyInfo : infos) {
if (notifyInfo.getName().equals(resource.getName())) {
return notifyInfo;
}
@@ -1252,8 +1241,7 @@ public class EclipseSynchronizer implements IFlushOperation {
NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.getParent());
if (infos == null) return;
Map<String, NotifyInfo> infoMap = new HashMap<>();
- for (int i = 0; i < infos.length; i++) {
- NotifyInfo notifyInfo = infos[i];
+ for (NotifyInfo notifyInfo : infos) {
infoMap.put(notifyInfo.getName(), notifyInfo);
}
infoMap.remove(resource.getName());
@@ -1282,8 +1270,8 @@ public class EclipseSynchronizer implements IFlushOperation {
infos = new BaserevInfo[] { info };
} else {
Map<String, BaserevInfo> infoMap = new HashMap<>();
- for (int i = 0; i < infos.length; i++) {
- infoMap.put(infos[i].getName(), infos[i]);
+ for (BaserevInfo i : infos) {
+ infoMap.put(i.getName(), i);
}
infoMap.put(info.getName(), info);
BaserevInfo[] newInfos = new BaserevInfo[infoMap.size()];
@@ -1304,8 +1292,7 @@ public class EclipseSynchronizer implements IFlushOperation {
public BaserevInfo getBaserevInfo(IResource resource) throws CVSException {
BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
if (infos == null) return null;
- for (int i = 0; i < infos.length; i++) {
- BaserevInfo info = infos[i];
+ for (BaserevInfo info : infos) {
if (info.getName().equals(resource.getName())) {
return info;
}
@@ -1321,8 +1308,8 @@ public class EclipseSynchronizer implements IFlushOperation {
BaserevInfo[] infos = SyncFileWriter.readAllBaserevInfo(resource.getParent());
if (infos == null) return;
Map<String, BaserevInfo> infoMap = new HashMap<>();
- for (int i = 0; i < infos.length; i++) {
- infoMap.put(infos[i].getName(), infos[i]);
+ for (BaserevInfo info : infos) {
+ infoMap.put(info.getName(), info);
}
infoMap.remove(resource.getName());
BaserevInfo[] newInfos = new BaserevInfo[infoMap.size()];
@@ -1389,8 +1376,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// get the folders involved
IContainer[] folders = getParentFolders(resources, depth);
// for all folders that have a CVS folder, ensure the sync info is cached
- for (int i = 0; i < folders.length; i++) {
- IContainer parent = folders[i];
+ for (IContainer parent : folders) {
if (!getSyncInfoCacheFor(parent).isSyncInfoLoaded(parent)) {
return false;
}
@@ -1410,8 +1396,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// get the folders involved
IContainer[] folders = getParentFolders(resources, depth);
// Cache the sync info for all the folders
- for (int i = 0; i < folders.length; i++) {
- IContainer parent = folders[i];
+ for (IContainer parent : folders) {
ISchedulingRule rule = null;
try {
rule = beginBatching(parent, null);
@@ -1435,8 +1420,7 @@ public class EclipseSynchronizer implements IFlushOperation {
*/
private IContainer[] getParentFolders(IResource[] resources, int depth) throws CVSException {
final Set<IResource> folders = new HashSet<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
folders.add(resource.getProject());
if (resource.getType() != IResource.PROJECT) {
folders.add(resource.getParent());
@@ -1755,8 +1739,8 @@ public class EclipseSynchronizer implements IFlushOperation {
boolean okToSet = !modified;
// Obtain the children while we're locked to ensure some were not added or changed
ICVSResource[] children = cvsFolder.members(ICVSFolder.ALL_UNIGNORED_MEMBERS);
- for (int i = 0; i < children.length; i++) {
- IResource resource = children[i].getIResource();
+ for (ICVSResource child : children) {
+ IResource resource = child.getIResource();
if (modified) {
if (getDirtyIndicator(resource) == IS_DIRTY_INDICATOR) {
okToSet = true;
@@ -1805,8 +1789,7 @@ public class EclipseSynchronizer implements IFlushOperation {
monitor = Policy.monitorFor(monitor);
monitor.beginTask(null, 100);
rule = beginBatching(projectsRule, monitor);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
try {
created(resource);
} catch (CVSException e) {
@@ -1821,8 +1804,7 @@ public class EclipseSynchronizer implements IFlushOperation {
private ISchedulingRule getProjectRule(IResource[] resources) {
HashSet<IProject> set = new HashSet<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
set.add(resource.getProject());
}
IProject[] projects = set.toArray(new IProject[set.size()]);
@@ -1875,8 +1857,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// Purge new resource sync before restoring from phantom
ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
ICVSResource[] children = cvsFolder.members(ICVSFolder.MANAGED_MEMBERS);
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
deleteResourceSync(resource.getIResource());
}
}
@@ -1889,8 +1870,7 @@ public class EclipseSynchronizer implements IFlushOperation {
// Indicate that a member has changed so the entries file gets written (see bug 181546)
IResource[] members = members(folder);
IResource changedResource = null;
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
+ for (IResource resource : members) {
if (getSyncBytes(resource) != null) {
changedResource = resource;
break;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
index dace20051..fe42611c1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/FileContentCachingService.java
@@ -122,8 +122,7 @@ public class FileContentCachingService {
private String[] getUncachedFiles() {
if (fileDiffs.length == 0) return fileDiffs;
List<String> existing = new ArrayList<>();
- for (int i = 0; i < fileDiffs.length; i++) {
- String filePath = fileDiffs[i];
+ for (String filePath : fileDiffs) {
try {
ICVSFile file = remoteRoot.getFile(filePath);
if (file instanceof RemoteFile) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index 73d7d66c8..dba46aa20 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -94,8 +94,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
} else {
resources = members(ICVSFolder.FILE_MEMBERS);
}
- for (int i = 0; i < resources.length; i++) {
- resources[i].accept(visitor, recurse);
+ for (ICVSResource resource : resources) {
+ resource.accept(visitor, recurse);
}
}
@@ -233,8 +233,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
boolean includeManaged = (((flags & MANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0));
boolean includeUnmanaged = (((flags & UNMANAGED_MEMBERS) != 0) || ((flags & (MANAGED_MEMBERS | UNMANAGED_MEMBERS | IGNORED_MEMBERS)) == 0));
boolean includeIgnored = ((flags & IGNORED_MEMBERS) != 0);
- for (int i = 0; i < resources.length; i++) {
- ICVSResource cvsResource = resources[i];
+ for (ICVSRemoteResource cvsResource : resources) {
if ((includeFiles && ( ! cvsResource.isFolder()))
|| (includeFolders && (cvsResource.isFolder()))) {
boolean isManaged = cvsResource.isManaged();
@@ -340,9 +339,10 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }),repository);
throw new CVSException(status);
}
- for (int i=0;i<children.length;i++) {
- if (children[i].getName().equals(path))
- return children[i];
+ for (ICVSRemoteResource c : children) {
+ if (c.getName().equals(path)) {
+ return c;
+ }
}
}
IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }),repository);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
index b2bf01607..de7707516 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
@@ -295,12 +295,10 @@ public class RemoteFolderMemberFetcher implements IUpdateMessageListener, IStatu
public ICVSRemoteResource[] getFetchedChildren() {
ICVSRemoteResource[] resources = new ICVSRemoteResource[folders.size() + files.size()];
int count = 0;
- for (Iterator iter = folders.iterator(); iter.hasNext();) {
- ICVSRemoteResource resource = (ICVSRemoteResource) iter.next();
+ for (ICVSRemoteResource resource : folders) {
resources[count++] = resource;
}
- for (Iterator iter = files.iterator(); iter.hasNext();) {
- ICVSRemoteResource resource = (ICVSRemoteResource) iter.next();
+ for (ICVSRemoteResource resource : files) {
resources[count++] = resource;
}
return resources;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderSandbox.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderSandbox.java
index 0171bc54d..85a38479a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderSandbox.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderSandbox.java
@@ -102,17 +102,17 @@ public class RemoteFolderSandbox extends RemoteFolder {
public void acceptChildren(ICVSResourceVisitor visitor) throws CVSException {
ICVSRemoteResource[] children = getChildren();
if (children == null) return;
- for (int i=0; i<children.length; i++) {
- ((ICVSResource)children[i]).accept(visitor);
+ for (ICVSRemoteResource c : children) {
+ ((ICVSResource) c).accept(visitor);
}
}
public void remove(RemoteFile file) {
ICVSRemoteResource[] children = getChildren();
ArrayList<ICVSRemoteResource> results = new ArrayList<>();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != file){
- results.add(children[i]);
+ for (ICVSRemoteResource c : children) {
+ if (c != file) {
+ results.add(c);
}
}
setChildren(results.toArray(new ICVSRemoteResource[results.size()]));
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java
index df979cff2..ab737997a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTree.java
@@ -67,8 +67,8 @@ public class RemoteFolderTree extends RemoteFolder {
public void acceptChildren(ICVSResourceVisitor visitor) throws CVSException {
ICVSRemoteResource[] children = getChildren();
if (children == null) return;
- for (int i=0; i<children.length; i++) {
- ((ICVSResource)children[i]).accept(visitor);
+ for (ICVSRemoteResource c : children) {
+ ((ICVSResource) c).accept(visitor);
}
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index 6ff79882a..97b65a345 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -178,8 +178,7 @@ public class RemoteFolderTreeBuilder {
// Get the arguments from the files
ArrayList<String> arguments = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
+ for (ICVSResource resource : resources) {
arguments.add(resource.getRelativePath(root));
}
@@ -381,8 +380,8 @@ public class RemoteFolderTreeBuilder {
// Build the child folders corresponding to local folders base
ICVSResource[] folders = local.members(ICVSFolder.FOLDER_MEMBERS);
- for (int i=0;i<folders.length;i++) {
- ICVSFolder folder = (ICVSFolder)folders[i];
+ for (ICVSResource f : folders) {
+ ICVSFolder folder = (ICVSFolder) f;
if (folder.isManaged() && folder.isCVSFolder()) {
monitor.worked(1);
RemoteFolder tree = buildBaseTree(remote, folder, monitor);
@@ -393,8 +392,8 @@ public class RemoteFolderTreeBuilder {
// Build the child files corresponding to local files base
ICVSResource[] files = local.members(ICVSFolder.FILE_MEMBERS);
- for (int i=0;i<files.length;i++) {
- ICVSFile file = (ICVSFile)files[i];
+ for (ICVSResource f : files) {
+ ICVSFile file = (ICVSFile) f;
byte[] syncBytes = file.getSyncBytes();
// if there is no sync info then there is no base
if (syncBytes==null)
@@ -459,21 +458,17 @@ public class RemoteFolderTreeBuilder {
if (local != null) {
// Build the child folders corresponding to local folders
ICVSResource[] folders = local.members(ICVSFolder.FOLDER_MEMBERS);
- for (int i=0;i<folders.length;i++) {
- ICVSFolder folder = (ICVSFolder)folders[i];
+ for (ICVSResource f : folders) {
+ ICVSFolder folder = (ICVSFolder) f;
DeltaNode d = (DeltaNode)deltas.get(folder.getName());
if (folder.isCVSFolder() && ! isOrphanedSubtree(folder) && (d==null || d.getRevision() != DELETED)) {
- children.put(folders[i].getName(),
- new RemoteFolderTree(remote, folders[i].getName(), repository,
- folder.getFolderSyncInfo().getRepository(),
- tagForRemoteFolder(folder,tag)));
+ children.put(f.getName(), new RemoteFolderTree(remote, f.getName(), repository, folder.getFolderSyncInfo().getRepository(), tagForRemoteFolder(folder,tag)));
}
}
// Build the child files corresponding to local files
ICVSResource[] files = local.members(ICVSFolder.FILE_MEMBERS);
- for (int i=0;i<files.length;i++) {
- ICVSFile file = (ICVSFile)files[i];
-
+ for (ICVSResource f : files) {
+ ICVSFile file = (ICVSFile) f;
DeltaNode d = (DeltaNode)deltas.get(file.getName());
byte[] syncBytes = file.getSyncBytes();
// if there is no sync info then there isn't a remote file for this local file on the
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
index 21b39973e..dc0dfc496 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
@@ -70,10 +70,9 @@ public class RemoteModule extends RemoteFolder {
Map moduleAliases = new HashMap();
// First pass: Create the remote module instances based on remote mapping
- for (int i = 0; i < moduleDefinitionStrings.length; i++) {
-
+ for (String moduleDefinitionString : moduleDefinitionStrings) {
// Read the module name
- StringTokenizer tokenizer = new StringTokenizer(moduleDefinitionStrings[i]);
+ StringTokenizer tokenizer = new StringTokenizer(moduleDefinitionString);
String moduleName = tokenizer.nextToken();
List<LocalOption> localOptionsList;
String next;
@@ -108,7 +107,7 @@ public class RemoteModule extends RemoteFolder {
}
} catch (NoSuchElementException e) {
// There is an invalid entry in the modules file. Log it and continue
- CVSProviderPlugin.log(IStatus.WARNING, NLS.bind(CVSMessages.RemoteModule_invalidDefinition, new String[] { moduleDefinitionStrings[i], repository.getLocation(true) }), null);
+ CVSProviderPlugin.log(IStatus.WARNING, NLS.bind(CVSMessages.RemoteModule_invalidDefinition, new String[]{moduleDefinitionString, repository.getLocation(true)}), null);
continue;
}
LocalOption[] localOptions = localOptionsList.toArray(new LocalOption[localOptionsList.size()]);
@@ -172,17 +171,17 @@ public class RemoteModule extends RemoteFolder {
String[] expansion = (String[])moduleAliases.get(moduleName);
List referencedFolders = new ArrayList();
boolean expandable = true;
- for (int i = 0; i < expansion.length; i++) {
- if (expansion[i].charAt(0) == '!') {
+ for (String e : expansion) {
+ if (e.charAt(0) == '!') {
// XXX Unsupported for now
expandable = false;
} else {
- IPath path = new Path(null, expansion[i]);
+ IPath path = new Path(null, e);
if (path.segmentCount() > 1) {
// XXX Unsupported for now
expandable = false;
} else {
- RemoteModule child = (RemoteModule)modules.get(expansion[i]);
+ RemoteModule child = (RemoteModule) modules.get(e);
if (child == null) {
referencedFolders.add(new RemoteFolder(null, repository, path.toString(), tag));
} else {
@@ -214,8 +213,8 @@ public class RemoteModule extends RemoteFolder {
RemoteModule module = (RemoteModule)modules.get(moduleName);
List<RemoteModule> referencedFolders = new ArrayList<>();
boolean expandable = true;
- for (int i = 0; i < children.length; i++) {
- RemoteModule child = (RemoteModule)modules.get(children[i].substring(1));
+ for (String c : children) {
+ RemoteModule child = (RemoteModule) modules.get(c.substring(1));
if (child == null) {
// invalid module definition
expandable = false;
@@ -316,8 +315,7 @@ public class RemoteModule extends RemoteFolder {
ICVSRemoteResource[] children = getChildren();
if (children != null) {
List taggedChildren = new ArrayList(children.length);
- for (int i = 0; i < children.length; i++) {
- ICVSRemoteResource resource = children[i];
+ for (ICVSRemoteResource resource : children) {
taggedChildren.add(((RemoteResource)resource).forTag(r, tagName));
}
r.setChildren((ICVSRemoteResource[]) taggedChildren.toArray(new ICVSRemoteResource[taggedChildren.size()]));
@@ -325,8 +323,8 @@ public class RemoteModule extends RemoteFolder {
}
if (referencedModules != null) {
List taggedModules = new ArrayList(referencedModules.length);
- for (int i = 0; i < referencedModules.length; i++) {
- RemoteModule module = (RemoteModule)referencedModules[i];
+ for (ICVSRemoteResource referencedModule : referencedModules) {
+ RemoteModule module = (RemoteModule) referencedModule;
taggedModules.add(module.forTag(r, tagName));
}
r.setReferencedModules((ICVSRemoteResource[]) taggedModules.toArray(new ICVSRemoteResource[taggedModules.size()]));
@@ -358,9 +356,10 @@ public class RemoteModule extends RemoteFolder {
// and use the inherited method in the other cases
if (referencedModules != null) {
if (!path.contains(Session.SERVER_SEPARATOR)) {
- for (int i=0;i<referencedModules.length;i++) {
- if (referencedModules[i].getName().equals(path))
- return referencedModules[i];
+ for (ICVSRemoteResource referencedModule : referencedModules) {
+ if (referencedModule.getName().equals(path)) {
+ return referencedModule;
+ }
}
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
index 3ec9dc795..5d78afc5b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
@@ -154,8 +154,7 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
EclipseSynchronizer.getInstance().adjustDirtyStateRecursively(container, RECOMPUTE_INDICATOR);
}
IResource[] members = container.members();
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
+ for (IResource resource : members) {
purgeResourceSyncCache(resource);
flushed.add(resource);
if (deep && resource.getType() != IResource.FILE) {
@@ -406,12 +405,11 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
} else {
projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
}
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
RepositoryProvider provider = RepositoryProvider.getProvider(
- project,
- CVSProviderPlugin.getTypeId());
-
+ project,
+ CVSProviderPlugin.getTypeId());
+
// found a project managed by CVS, convert each session property on a
// folder to a sync object.
if (provider != null) {
@@ -462,8 +460,8 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
if (resource.getType() != IResource.FILE) {
ResourcesPlugin.getWorkspace().getSynchronizer().flushSyncInfo(FOLDER_DIRTY_STATE_KEY, resource, IResource.DEPTH_INFINITE);
IResource[] members = ((IContainer)resource).members();
- for (int i = 0; i < members.length; i++) {
- purgeDirtyCache(members[i]);
+ for (IResource member : members) {
+ purgeDirtyCache(member);
}
}
} catch (CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
index c93f23583..58f091db6 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
@@ -254,8 +254,7 @@ import org.eclipse.team.internal.ccvs.core.util.Util;
String indicator = NOT_DIRTY_INDICATOR;
ICVSResource[] children = cvsFolder.members(ICVSFolder.MANAGED_MEMBERS | ICVSFolder.PHANTOM_MEMBERS);
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
+ for (ICVSResource resource : children) {
// keep looking into phantom folders until a managed phantom file
// is found.
if (resource.isFolder()) {
@@ -305,8 +304,7 @@ import org.eclipse.team.internal.ccvs.core.util.Util;
IResource[] pendingWrites = getPendingCacheWrites();
if (pendingWrites != null){
HashSet<IResource> cachedResources = new HashSet<>();
- for (int i = 0; i < pendingWrites.length; i++) {
- IResource resource = pendingWrites[i];
+ for (IResource resource : pendingWrites) {
if (resource.getParent().equals(folder))
cachedResources.add(resource);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java
index c062b6a19..df4ba864f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java
@@ -235,8 +235,7 @@ public class UpdateContentCachingService implements IUpdateMessageListener {
throw new CVSException(status);
}
}
- for (Iterator iterator = removed.iterator(); iterator.hasNext();) {
- ICVSResource resource = (ICVSResource) iterator.next();
+ for (ICVSResource resource : removed) {
if (resource.exists())
resource.delete();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantResourceVariantByteStore.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantResourceVariantByteStore.java
index 13e0bea0b..a87356a78 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSDescendantResourceVariantByteStore.java
@@ -79,8 +79,7 @@ public class CVSDescendantResourceVariantByteStore extends DescendantResourceVar
public IStatus handleResourceChanges(IResource[] changedResources, boolean canModifyWorkspace) {
// IMPORTANT NOTE: This will throw exceptions if performed during the POST_CHANGE delta phase!!!
List errors = new ArrayList();
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
+ for (IResource resource : changedResources) {
try {
if (!isInCVSProject(resource)) continue;
if (resource.getType() == IResource.FILE
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java
index d15e2158c..c6e060638 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java
@@ -89,8 +89,7 @@ public class CVSResourceVariantTree extends ResourceVariantTree {
members.addAll(Arrays.asList(super.members(resource)));
try {
IResource[] localMembers = EclipseSynchronizer.getInstance().members((IContainer) resource); //((IContainer)resource).members(true);
- for (int i = 0; i < localMembers.length; i++) {
- IResource local = localMembers[i];
+ for (IResource local : localMembers) {
if (local.getType() != IResource.FILE) {
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
if (folder.isCVSFolder()) {
@@ -248,8 +247,7 @@ public class CVSResourceVariantTree extends ResourceVariantTree {
List children = new ArrayList();
List changedResources = new ArrayList();
children.addAll(Arrays.asList(members));
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (!children.contains(resource)) {
// These sync bytes are stale. Purge them
flushVariants(resource, IResource.DEPTH_INFINITE);
@@ -273,8 +271,7 @@ public class CVSResourceVariantTree extends ResourceVariantTree {
if (local.getType() != IResource.FILE && (local.exists() || local.isPhantom())) {
IResource[] allChildren = ((IContainer)local).members(true /* include phantoms */);
List childrenWithSyncBytes = new ArrayList();
- for (int i = 0; i < allChildren.length; i++) {
- IResource resource = allChildren[i];
+ for (IResource resource : allChildren) {
if (getByteStore().getBytes(resource) != null) {
childrenWithSyncBytes.add(resource);
}
@@ -333,8 +330,7 @@ public class CVSResourceVariantTree extends ResourceVariantTree {
private boolean isJobInFamilyRunning(Object family) {
Job[] jobs = Job.getJobManager().find(family);
if (jobs != null && jobs.length > 0) {
- for (int i = 0; i < jobs.length; i++) {
- Job job = jobs[i];
+ for (Job job : jobs) {
if (job.getState() != Job.NONE) {
return true;
}
@@ -366,8 +362,7 @@ public class CVSResourceVariantTree extends ResourceVariantTree {
RemoteFolderTree remote = RemoteFolderTree.fromBytes(parent, resource, remoteBytes);
IResource[] members = members(resource);
List children = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- IResource member = members[i];
+ for (IResource member : members) {
ICVSRemoteResource child = buildTree(remote, member, immutable, monitor);
if (child != null)
children.add(child);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java
index 94c96483a..bf7c77fce 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java
@@ -107,8 +107,7 @@ public class DeferredResourceChangeHandler extends BackgroundEventHandler {
}
IResource[] deletions = (IResource[]) conflictingDeletion.toArray(new IResource[conflictingDeletion.size()]);
conflictingDeletion.clear();
- for (int i = 0; i < deletions.length; i++) {
- IResource resource = deletions[i];
+ for (IResource resource : deletions) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
try {
if(!cvsResource.isFolder() && cvsResource.isManaged()) {
@@ -124,8 +123,7 @@ public class DeferredResourceChangeHandler extends BackgroundEventHandler {
private Map getResourcesByProject(IResource[] resources) {
Map result = new HashMap();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IProject project = resource.getProject();
List projectResources = (List)result.get(project);
if (projectResources == null) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
index 125df45d5..01e5c9d07 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
@@ -100,8 +100,7 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
try {
IResourceDelta root = event.getDelta();
IResourceDelta[] projectDeltas = root.getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- final IResourceDelta delta = projectDeltas[i];
+ for (IResourceDelta delta : projectDeltas) {
IResource resource = delta.getResource();
if (resource.getType() == IResource.PROJECT) {
@@ -109,8 +108,8 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
if (!resource.isAccessible()) continue;
}
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
-
+ RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
+
// Make sure that the project is a CVS folder.
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resource.getProject());
if (provider != null) {
@@ -125,7 +124,7 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
}
// if a project is moved the originating project will not be associated with the CVS provider
- // however listeners will probably still be interested in the move delta.
+ // however listeners will probably still be interested in the move delta.
if ((delta.getFlags() & IResourceDelta.MOVED_TO) > 0) {
IResource destination = getResourceFor(resource.getProject(), resource, delta.getMovedToPath());
provider = RepositoryProvider.getProvider(destination.getProject());
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java
index 7a99deb94..d0745f538 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileNameMatcher.java
@@ -36,8 +36,8 @@ public class FileNameMatcher {
}
void register(String[] patterns) {
- for (int i = 0; i < patterns.length; i++) {
- register(patterns[i],TRUE);
+ for (String pattern : patterns) {
+ register(pattern, TRUE);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java
index 0a4ca0659..9b2de723b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/KnownRepositories.java
@@ -204,8 +204,7 @@ public class KnownRepositories implements INodeChangeListener, IPreferenceChange
prefs.addNodeChangeListener(this);
try {
String[] keys = prefs.childrenNames();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
+ for (String key : keys) {
try {
IEclipsePreferences node = (IEclipsePreferences) prefs.node(key);
node.addPreferenceChangeListener(this);
@@ -238,10 +237,10 @@ public class KnownRepositories implements INodeChangeListener, IPreferenceChange
// If the file did not exist, then prime the list of repositories with
// the providers with which the projects in the workspace are shared.
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(projects[i], CVSProviderPlugin.getTypeId());
+ for (IProject project : projects) {
+ RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
if (provider!=null) {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(projects[i]);
+ ICVSFolder folder = (ICVSFolder) CVSWorkspaceRoot.getCVSResourceFor(project);
FolderSyncInfo info = folder.getFolderSyncInfo();
if (info != null) {
addRepository(getRepository(info.getRoot()), false);
@@ -260,8 +259,7 @@ public class KnownRepositories implements INodeChangeListener, IPreferenceChange
// Get a snapshot of the listeners so the list doesn't change while we're firing
ICVSListener[] listeners = getListeners();
// Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
- for (int i = 0; i < listeners.length; i++) {
- ICVSListener listener = listeners[i];
+ for (ICVSListener listener : listeners) {
notification.run(listener);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
index cae80c613..b3660855c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
@@ -270,8 +270,7 @@ public class MoveDeleteHook implements IMoveDeleteHook {
final List readOnlyFiles = new ArrayList();
try {
// Find any read-only files
- for (int i = 0; i < folders.length; i++) {
- IFolder folder = folders[i];
+ for (IFolder folder : folders) {
if (folder.exists()) {
folder.accept(resource -> {
if (resource.getType() == IResource.FILE) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
index 25a10777f..1ecdb5756 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
@@ -149,14 +149,13 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
folder.acceptChildren(this);
} else if (depth == IResource.DEPTH_ONE) {
ICVSResource[] files = folder.members(ICVSFolder.FILE_MEMBERS);
- for (int i = 0; i < files.length; i++) {
- files[i].accept(this);
+ for (ICVSResource file : files) {
+ file.accept(this);
}
}
// Also delete ignored child files that start with .#
ICVSResource[] ignoredFiles = folder.members(ICVSFolder.FILE_MEMBERS | ICVSFolder.IGNORED_MEMBERS);
- for (int i = 0; i < ignoredFiles.length; i++) {
- ICVSResource cvsResource = ignoredFiles[i];
+ for (ICVSResource cvsResource : ignoredFiles) {
if (cvsResource.getName().startsWith(".#")) { //$NON-NLS-1$
cvsResource.delete();
}
@@ -171,11 +170,11 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
CVSWorkspaceRoot.getCVSFolderFor(project).run(pm1 -> {
monitor = Policy.infiniteSubMonitorFor(pm1, 100);
monitor.beginTask(null, 512);
- for (int i = 0; i < resources.length; i++) {
+ for (ICVSResource resource : resources) {
if (oneArgMessage != null) {
- monitor.subTask(NLS.bind(oneArgMessage, new String[] { resources[i].getIResource().getFullPath().toString() }));
+ monitor.subTask(NLS.bind(oneArgMessage, new String[]{resource.getIResource().getFullPath().toString()}));
}
- resources[i].accept(PrepareForReplaceVisitor.this);
+ resource.accept(PrepareForReplaceVisitor.this);
}
monitor.done();
}, pm);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java
index 96c47ded4..99e2d1c89 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceStateChangeListeners.java
@@ -73,8 +73,7 @@ public class ResourceStateChangeListeners {
// Get a snapshot of the listeners so the list doesn't change while we're firing
IResourceStateChangeListener[] listeners = getListeners();
// Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
- for (int i = 0; i < listeners.length; i++) {
- IResourceStateChangeListener listener = listeners[i];
+ for (IResourceStateChangeListener listener : listeners) {
notification.run(listener);
}
}
@@ -149,8 +148,7 @@ public class ResourceStateChangeListeners {
System.out.print(" from thread " + Thread.currentThread().getName()); //$NON-NLS-1$
System.out.print(" for the following " + resources.length + " resources"); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println(":"); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
System.out.println(resource.getFullPath().toString());
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java
index c04708776..e81337326 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java
@@ -133,8 +133,8 @@ public class SyncFileChangeListener implements IResourceChangeListener {
if(isMetaFile(resource)) {
IResource[] toBeNotified = handleChangedMetaFile(resource);
if(toBeNotified.length>0 && isModifiedBy3rdParty(resource)) {
- for (int i = 0; i < toBeNotified.length; i++) {
- changedContainers.add(toBeNotified[i]);
+ for (IResource t : toBeNotified) {
+ changedContainers.add(t);
}
if(Policy.DEBUG_METAFILE_CHANGES) {
System.out.println("[cvs] metafile changed by 3rd party: " + resource.getFullPath()); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
index b63bf4a2e..5bdbdcce3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
@@ -84,8 +84,7 @@ public class SyncFileWriter {
String[] entries = readLines(cvsSubDir.getFile(ENTRIES));
if (entries == null) return null;
Map infos = new TreeMap();
- for (int i = 0; i < entries.length; i++) {
- String line = entries[i];
+ for (String line : entries) {
if(!FOLDER_TAG.equals(line) && !"".equals(line)) { //$NON-NLS-1$
try {
ResourceSyncInfo info = new ResourceSyncInfo(line, null);
@@ -93,7 +92,7 @@ public class SyncFileWriter {
} catch (CVSException e) {
// There was a problem parsing the entry line.
// Log the problem and skip the entry
- CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.SyncFileWriter_0, new String[] { parent.getFullPath().toString() }), e));
+ CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.SyncFileWriter_0, new String[] { parent.getFullPath().toString() }), e));
}
}
}
@@ -101,8 +100,7 @@ public class SyncFileWriter {
// process Entries.log file contents
String[] entriesLog = readLines(cvsSubDir.getFile(ENTRIES_LOG));
if (entriesLog != null) {
- for (int i = 0; i < entriesLog.length; i++) {
- String line = entriesLog[i];
+ for (String line : entriesLog) {
if (line.startsWith(ADD_TAG)) {
line = line.substring(ADD_TAG.length());
ResourceSyncInfo info = new ResourceSyncInfo(line, null);
@@ -279,8 +277,7 @@ public class SyncFileWriter {
return null;
// Split each line on spaces and tabs.
ArrayList/*<String>*/ entries = new ArrayList/*<String>*/();
- for (int ln = 0; ln < lines.length; ln++) {
- String line = lines[ln];
+ for (String line : lines) {
int pos = 0;
while (pos < line.length()) {
if (line.charAt(pos) == ' ' || line.charAt(pos) == '\t')
@@ -336,8 +333,7 @@ public class SyncFileWriter {
String[] entries = readLines(cvsSubDir.getFile(NOTIFY));
if (entries == null) return null;
Map infos = new TreeMap();
- for (int i = 0; i < entries.length; i++) {
- String line = entries[i];
+ for (String line : entries) {
if(!"".equals(line)) { //$NON-NLS-1$
try {
NotifyInfo info = new NotifyInfo(parent, line);
@@ -402,8 +398,7 @@ public class SyncFileWriter {
String[] entries = readLines(cvsSubDir.getFile(BASEREV));
if (entries == null) return null;
Map infos = new TreeMap();
- for (int i = 0; i < entries.length; i++) {
- String line = entries[i];
+ for (String line : entries) {
if(!"".equals(line)) { //$NON-NLS-1$
BaserevInfo info = new BaserevInfo(line);
infos.put(info.getName(), info);
@@ -616,8 +611,8 @@ public class SyncFileWriter {
byte[] lineEnd = getLineDelimiter();
try {
try {
- for (int i = 0; i < contents.length; i++) {
- os.write(contents[i].getBytes());
+ for (String content : contents) {
+ os.write(content.getBytes());
os.write(lineEnd);
}
} finally {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index e8078ccbf..71f680f27 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -368,8 +368,8 @@ public class Util {
return tag;
}
- for (int i = 0; i < members.length; i++) {
- if (members[i].getType() == IResource.FILE) {
+ for (IResource member : members) {
+ if (member.getType() == IResource.FILE) {
return tag;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/PServerSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/PServerSSH2ServerConnection.java
index 700719e82..55e5c20c7 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/PServerSSH2ServerConnection.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/PServerSSH2ServerConnection.java
@@ -95,10 +95,10 @@ public class PServerSSH2ServerConnection implements IServerConnection {
String[] list = session.getPortForwardingL();
String name = ":" + rhost + ":" + rport; //$NON-NLS-1$ //$NON-NLS-2$
boolean done = false;
- for (int i = 0; i < list.length; i++) {
- if (list[i].endsWith(name)) {
+ for (String l : list) {
+ if (l.endsWith(name)) {
try {
- String foo = list[i].substring(0, list[i].indexOf(':'));
+ String foo = l.substring(0, l.indexOf(':'));
lport = Integer.parseInt(foo);
} catch (Exception ee) {
// Ignore
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
index 1daca5d76..460e6d4f1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
@@ -46,8 +46,7 @@ public class AdaptableHierarchicalResourceList extends AdaptableResourceList {
private IResource[] getChildenFor(IContainer parent) {
Set children = new HashSet();
IPath parentPath = parent.getFullPath();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IPath resourcePath = resource.getFullPath();
if (parent instanceof IWorkspaceRoot) {
children.add(((IWorkspaceRoot)parent).getProject(resourcePath.segment(0)));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
index 06fbde3e5..50afc49af 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
@@ -466,8 +466,7 @@ public class CVSDecoration {
private boolean isRequestedProperty(String[] properties, String property) {
if (properties == null)
return true;
- for (int i = 0; i < properties.length; i++) {
- String string = properties[i];
+ for (String string : properties) {
if (string.equals(property))
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
index 3ecbab3a8..75d75a502 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
@@ -138,8 +138,8 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
Object[] result = dialog.getResult();
- for (int i = 0; i < result.length; i++) {
- fText.insert("{"+((Map.Entry)result[i]).getKey() +"}"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (Object r : result) {
+ fText.insert("{" + ((Map.Entry) r).getKey() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -428,20 +428,20 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
}
private void setColorsAndFonts(TreeItem[] items) {
- for (int i = 0; i < items.length; i++) {
+ for (TreeItem item : items) {
if (fGeneralTab.isFontDecorationEnabled()) {
- Color backGroundColor = getBackground(items[i].getData());
- items[i].setBackground(backGroundColor);
- Color foreGroundColor = getForeground(items[i].getData());
- items[i].setForeground(foreGroundColor);
- Font font = getFont(items[i].getData());
- items[i].setFont(font);
+ Color backGroundColor = getBackground(item.getData());
+ item.setBackground(backGroundColor);
+ Color foreGroundColor = getForeground(item.getData());
+ item.setForeground(foreGroundColor);
+ Font font = getFont(item.getData());
+ item.setFont(font);
} else {
- items[i].setBackground(null);
- items[i].setForeground(null);
- items[i].setFont(null);
+ item.setBackground(null);
+ item.setForeground(null);
+ item.setFont(null);
}
- setColorsAndFonts(items[i].getItems());
+ setColorsAndFonts(item.getItems());
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
index 792359752..960ab5251 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
@@ -69,8 +69,8 @@ public class CVSHistoryFilter extends ViewerFilter {
protected boolean branchMatch(CVSFileRevision revision) {
ITag[] branches = revision.getBranches();
- for (int i = 0; i < branches.length; i++) {
- if ((branches[i].getName().toLowerCase().indexOf(branchName.toLowerCase()) != -1)) {
+ for (ITag branche : branches) {
+ if (branche.getName().toLowerCase().indexOf(branchName.toLowerCase()) != -1) {
return true;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index 3329846d8..ec43c24a3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -1154,9 +1154,9 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
private IFileRevision getFileRevision(String revision) {
if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getContentIdentifier().equals(revision)) {
- return entries[i];
+ for (IFileRevision entry : entries) {
+ if (entry.getContentIdentifier().equals(revision)) {
+ return entry;
}
}
} else if (cvsFileHistory != null) {
@@ -1172,17 +1172,17 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
public void selectLocalRevision(long timeStamp){
IFileRevision entry = null;
if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getTimestamp() == timeStamp) {
- entry = entries[i];
+ for (IFileRevision e : entries) {
+ if (e.getTimestamp() == timeStamp) {
+ entry = e;
break;
}
}
}else if (cvsFileHistory != null) {
IFileRevision[] tempEntries = cvsFileHistory.getFileRevisions();
- for (int i = 0; i < tempEntries.length; i++) {
- if (tempEntries[i].getTimestamp() == timeStamp) {
- entry = tempEntries[i];
+ for (IFileRevision tempEntry : tempEntries) {
+ if (tempEntry.getTimestamp() == timeStamp) {
+ entry = tempEntry;
break;
}
}
@@ -1627,16 +1627,16 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
private void mapExpandedElements(Object[] expandedElements) {
//store the names of the currently expanded categories in a map
HashMap elementMap = new HashMap();
- for (int i=0; i<expandedElements.length; i++){
- elementMap.put(((DateHistoryCategory)expandedElements[i]).getName(), null);
+ for (Object expandedElement : expandedElements) {
+ elementMap.put(((DateHistoryCategory) expandedElement).getName(), null);
}
//Go through the new categories and keep track of the previously expanded ones
ArrayList expandable = new ArrayList();
- for (int i = 0; i<categories.length; i++){
+ for (AbstractHistoryCategory category : categories) {
//check to see if this category is currently expanded
- if (elementMap.containsKey(categories[i].getName())){
- expandable.add(categories[i]);
+ if (elementMap.containsKey(category.getName())) {
+ expandable.add(category);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java
index b42ad4343..555e8f1d0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistorySearchFilter.java
@@ -92,8 +92,8 @@ public class CVSHistorySearchFilter extends org.eclipse.jface.viewers.ViewerFilt
protected boolean branchNameMatch(CVSFileRevision revision) {
ITag[] branches = revision.getBranches();
- for (int i = 0; i < branches.length; i++) {
- String tag = branches[i].getName().toLowerCase();
+ for (ITag branche : branches) {
+ String tag = branche.getName().toLowerCase();
Iterator iter = searchStrings.iterator();
while (iter.hasNext()) {
if (!!tag.contains(((String) iter.next()).toLowerCase()))
@@ -106,8 +106,8 @@ public class CVSHistorySearchFilter extends org.eclipse.jface.viewers.ViewerFilt
protected boolean tagMatch(CVSFileRevision revision) {
ITag[] tags = revision.getTags();
- for (int i = 0; i < tags.length; i++) {
- String tag = tags[i].getName().toLowerCase();
+ for (ITag t : tags) {
+ String tag = t.getName().toLowerCase();
Iterator iter = searchStrings.iterator();
while (iter.hasNext()) {
if (!!tag.contains(((String) iter.next()).toLowerCase()))
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
index fb9c4d991..ecbaae729 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
@@ -317,8 +317,8 @@ public class CVSHistoryTableProvider {
if (currentRevisionFont == null) {
Font defaultFont = JFaceResources.getDefaultFont();
FontData[] data = defaultFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setStyle(SWT.BOLD);
+ for (FontData d : data) {
+ d.setStyle(SWT.BOLD);
}
currentRevisionFont = new Font(viewer.getTree().getDisplay(), data);
}
@@ -593,8 +593,8 @@ public class CVSHistoryTableProvider {
getSettingsInt(COL_AUTHOR_NAME),
getSettingsInt(COL_COMMENT_NAME) };
ColumnLayoutData weightData[] = getWeightData(widths);
- for (int i = 0; i < weightData.length; i++) {
- layout.addColumnData(weightData[i]);
+ for (ColumnLayoutData w : weightData) {
+ layout.addColumnData(w);
}
String sortName = settings.get(SORT_COL_NAME);
@@ -685,9 +685,8 @@ public class CVSHistoryTableProvider {
public void saveColumnLayout() {
TreeColumn columns[] = viewer.getTree().getColumns();
- for (int i = 0; i < columns.length; i++) {
- settings.put((String) columns[i].getData(COL_NAME), columns[i]
- .getWidth());
+ for (TreeColumn column : columns) {
+ settings.put((String) column.getData(COL_NAME), column.getWidth());
}
settings.put(SORT_COL_NAME, (String) viewer.getTree().getSortColumn()
.getData(COL_NAME));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
index 9a7f7608c..40ffd361b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
@@ -90,12 +90,11 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
private void ensureFontAndColorsCreated(final String[] fonts, final String[] colors) {
CVSUIPlugin.getStandardDisplay().syncExec(() -> {
ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- for (int i1 = 0; i1 < colors.length; i1++) {
- theme.getColorRegistry().get(colors[i1]);
-
+ for (String color : colors) {
+ theme.getColorRegistry().get(color);
}
- for (int i2 = 0; i2 < fonts.length; i2++) {
- theme.getFontRegistry().get(fonts[i2]);
+ for (String font : fonts) {
+ theme.getFontRegistry().get(font);
}
});
}
@@ -188,8 +187,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
private boolean isMappedToCVS(ResourceMapping mapping) {
IProject[] projects = mapping.getProjects();
boolean foundOne = false;
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
if (project != null) {
RepositoryProvider provider = RepositoryProvider.getProvider(project);
if (provider instanceof CVSTeamProvider) {
@@ -248,8 +246,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
private static boolean isSupervised(Object element) throws CoreException {
IResource[] resources = getTraversalRoots(element);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (getSubscriber().isSupervised(resource))
return true;
}
@@ -261,11 +258,9 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
ResourceMapping mapping = Utils.getResourceMapping(element);
if (mapping != null) {
ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ for (IResource resource : resources) {
result.add(resource);
}
}
@@ -391,8 +386,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
IResource[] resources = getTraversalRoots(element);
boolean first = true;
CVSTag tag = null;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (getSubscriber().isSupervised(resource)) {
CVSTag nextTag = getTagToShow(resource);
if (first) {
@@ -522,9 +516,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
boolean showingDeepDirtyIndicators = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
-
+ for (IResource resource : changedResources) {
if(showingDeepDirtyIndicators) {
addWithParents(resource, resourcesToUpdate);
} else {
@@ -584,8 +576,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
}
ResourceMapping mapping = Utils.getResourceMapping(element);
IProject[] projects = mapping.getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
if (!project.isAccessible()) {
return;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index ea9a9140a..db1f92bb2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
@@ -296,8 +296,7 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
final KSubstOption[] options = KSubstOption.getAllKSubstOptions();
final ArrayList<KSubstOption> KSUBST_MODES= new ArrayList<>();
- for (int i = 0; i < options.length; i++) {
- final KSubstOption option = options[i];
+ for (KSubstOption option : options) {
if (!option.isBinary()) {
KSUBST_MODES.add(option);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
index 6a786d621..543f4f8e7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
@@ -87,8 +87,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
private void initialize(ICVSRepositoryLocation oldLocation) {
allLocations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
List locations = new ArrayList();
- for (int i = 0; i < allLocations.length; i++) {
- ICVSRepositoryLocation location = allLocations[i];
+ for (ICVSRepositoryLocation location : allLocations) {
if (isCompatible(location, oldLocation)) {
locations.add(location);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
index c390dc1ae..a74736ced 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
@@ -163,8 +163,10 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
}
}
List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i] != null) result.add(projects[i]);
+ for (IProject project : projects) {
+ if (project != null) {
+ result.add(project);
+ }
}
return (IProject[])result.toArray(new IProject[result.size()]);
}
@@ -175,13 +177,12 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
if (newLocation.getUsername() == null || newLocation.getUsername().length() == 0) {
// look for an existing location that matched
ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
+ for (ICVSRepositoryLocation location : locations) {
if (location.getMethod() == newLocation.getMethod()
- && location.getHost().equals(newLocation.getHost())
- && location.getPort() == newLocation.getPort()
- && location.getRootDirectory().equals(newLocation.getRootDirectory()))
- return location;
+ && location.getHost().equals(newLocation.getHost())
+ && location.getPort() == newLocation.getPort()
+ && location.getRootDirectory().equals(newLocation.getRootDirectory()))
+ return location;
}
}
return newLocation;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index daf9546f3..a88999cd0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -183,8 +183,8 @@ public class CVSUIPlugin extends AbstractUIPlugin {
if (status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
if (promptToRefresh(parent, resources, status)) {
try {
- for (int i = 0; i < resources.length; i++) {
- resources[i].refreshLocal(IResource.DEPTH_INFINITE, null);
+ for (IResource resource : resources) {
+ resource.refreshLocal(IResource.DEPTH_INFINITE, null);
}
} catch (CoreException coreEx) {
// Throw the original exception to the caller
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
index 154a4f908..655fc6c07 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
@@ -101,8 +101,8 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
// populate list
String[] templates =
CVSUIPlugin.getPlugin().getRepositoryManager().getCommentTemplates();
- for (int i = 0; i < templates.length; i++) {
- viewer.add(templates[i]);
+ for (String template : templates) {
+ viewer.add(template);
}
createButtons(listAndButtons);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
index 11b8a76a2..fe47959c9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
@@ -130,8 +130,7 @@ public class CommitCommentArea extends DialogArea {
ICompletionProposal[] computeQuickAssistProposals = sourceViewer.getQuickAssistAssistant()
.getQuickAssistProcessor()
.computeQuickAssistProposals(sourceViewer.getQuickAssistInvocationContext());
- for (int i = 0; i < computeQuickAssistProposals.length; i++) {
- final ICompletionProposal proposal = computeQuickAssistProposals[i];
+ for (ICompletionProposal proposal : computeQuickAssistProposals) {
quickFixMenu.add(new Action(proposal.getDisplayString()) {
@Override
@@ -375,12 +374,12 @@ public class CommitCommentArea extends DialogArea {
fCombo.removeAll();
fCombo.add(fMessage);
- for (int i = 0; i < fCommentTemplates.length; i++) {
+ for (String commentTemplate : fCommentTemplates) {
fCombo.add(CVSUIMessages.CommitCommentArea_6 + ": " + //$NON-NLS-1$
- Util.flattenText(fCommentTemplates[i]));
+ Util.flattenText(commentTemplate));
}
- for (int i = 0; i < fComments.length; i++) {
- fCombo.add(Util.flattenText(fComments[i]));
+ for (String comment : fComments) {
+ fCombo.add(Util.flattenText(comment));
}
fCombo.setText(fMessage);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
index c9b45d214..dbdb7443e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
@@ -176,10 +176,10 @@ public class EditorsView extends ViewPart {
*/
private long extractDate(String dateString) {
if (dateString != null) {
- for (int i = 0; i < dateFormats.length; i++) {
- dateFormats[i].setLenient(true);
+ for (DateFormat dateFormat : dateFormats) {
+ dateFormat.setLenient(true);
try {
- return dateFormats[i].parse(dateString).getTime();
+ return dateFormat.parse(dateString).getTime();
} catch (ParseException ex) {
// silently ignored
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
index 2ee5879ef..dff09346b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
@@ -255,8 +255,8 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
cvsRshParameters.setText(parameters);
cvsServer.setText(server);
IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- String name = methods[i].getName();
+ for (IConnectionMethod m : methods) {
+ String name = m.getName();
if (!name.equals("ext")) { //$NON-NLS-1$
methodType.add(name);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
index 3941ece06..e410183b2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
@@ -246,8 +246,7 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
try {
CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
subscriber.refresh(files, IResource.DEPTH_ZERO, monitor);
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
+ for (IFile file : files) {
SyncInfo info = subscriber.getSyncInfo(file);
int direction = info.getKind() & SyncInfo.DIRECTION_MASK;
if (direction == SyncInfo.CONFLICTING || direction == SyncInfo.INCOMING) {
@@ -279,8 +278,7 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
if (!isNeverUpdate()) {
// We may need to perform an update so we need to obtain the lock on each project
Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (isReadOnly(resource))
projects.add(resource.getProject());
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
index 5e2cddfc5..e0ae44760 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
@@ -151,8 +151,8 @@ public class HistoryTableProvider {
if (currentRevisionFont == null) {
Font defaultFont = JFaceResources.getDefaultFont();
FontData[] data = defaultFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setStyle(SWT.BOLD);
+ for (FontData d : data) {
+ d.setStyle(SWT.BOLD);
}
currentRevisionFont = new Font(viewer.getTable().getDisplay(), data);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
index cdc1748cc..61eeea166 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
@@ -266,8 +266,8 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
return;
}
FileNameMatcher matcher = new FileNameMatcher(new String[] { customPattern });
- for (int i = 0; i < resources.length; i++) {
- String name = resources[i].getName();
+ for (IResource resource : resources) {
+ String name = resource.getName();
if (! matcher.match(name)) {
setError(NLS.bind(CVSUIMessages.IgnoreResourcesDialog_patternDoesNotMatchFile, new String[] { name }));
return;
@@ -329,25 +329,28 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
}
private IResource getResourceWithSpace() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getName().indexOf(" ") != -1) //$NON-NLS-1$
- return resources[i];
+ for (IResource resource : resources) {
+ if (resource.getName().indexOf(" ") != -1) { //$NON-NLS-1$
+ return resource;
+ }
}
return null;
}
private boolean checkIfAllResourcesWithSpacesHaveExtensions() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getName().indexOf(" ") != -1 && resources[i].getFileExtension() == null) //$NON-NLS-1$
+ for (IResource resource : resources) {
+ if (resource.getName().indexOf(" ") != -1 && resource.getFileExtension() == null) { //$NON-NLS-1$
return false;
+ }
}
return true;
}
private boolean checkIfAllResourcesHaveExtensions() {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getFileExtension() != null)
+ for (IResource resource : resources) {
+ if (resource.getFileExtension() != null) {
return true;
+ }
}
// couldn't find a resource with an extension
return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
index 2a82e1676..b7b6dedef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
@@ -89,11 +89,10 @@ public class RemoteRevisionQuickDiffProvider implements IQuickDiffReferenceProvi
@Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
if(fReferenceInitialized) {
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
+ for (ISubscriberChangeEvent delta : deltas) {
IResource resource = delta.getResource();
- if(resource.getType() == IResource.FILE &&
- fLastSyncState != null && resource.equals(fLastSyncState.getLocal())) {
+ if(resource.getType() == IResource.FILE &&
+ fLastSyncState != null && resource.equals(fLastSyncState.getLocal())) {
if(delta.getFlags() == ISubscriberChangeEvent.SYNC_CHANGED) {
fetchContentsInJob();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
index d593e8abb..dfd655fa4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
@@ -92,9 +92,10 @@ public class SelectionPropertyTester extends PropertyTester {
private static Method findMethod(Class clazz, String method)
throws Exception {
Method[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(method))
- return methods[i];
+ for (Method m : methods) {
+ if (m.getName().equals(method)) {
+ return m;
+ }
}
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
index 00943a978..f98fef82d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
@@ -41,15 +41,15 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
// Initialize USE_ALTERNATE_PROMPTER
IIgnoreInfo[] ignores = Team.getAllIgnores();
boolean found = false;
- for (int i = 0; i < ignores.length; i++) {
- if (ignores[i].getPattern().equals("*.notes")) { //$NON-NLS-1$
+ for (IIgnoreInfo ignore : ignores) {
+ if (ignore.getPattern().equals("*.notes")) { //$NON-NLS-1$
found = true;
}
}
if (!found) return;
IStringMapping[] mappings = Team.getFileContentManager().getExtensionMappings();
- for (int i = 0; i < mappings.length; i++) {
- if (mappings[i].getString().equals("notes")) { //$NON-NLS-1$
+ for (IStringMapping mapping : mappings) {
+ if (mapping.getString().equals("notes")) { //$NON-NLS-1$
USE_ALTERNATE_PROMPTER = true;
return;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
index 29a699e29..a76f60759 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
@@ -188,9 +188,9 @@ public class WorkingSetSelectionArea extends DialogArea {
}
// remove deleted working sets from the mru list box
String[] mruNames = mruList.getItems();
- for (int i = 0; i < mruNames.length; i++) {
- if (workingSetManager.getWorkingSet(mruNames[i]) == null) {
- mruList.remove(mruNames[i]);
+ for (String mruName : mruNames) {
+ if (workingSetManager.getWorkingSet(mruName) == null) {
+ mruList.remove(mruName);
}
}
}
@@ -232,10 +232,10 @@ public class WorkingSetSelectionArea extends DialogArea {
private void initializeMru() {
IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- String workingSetName = workingSets[i].getName();
+ for (IWorkingSet w : workingSets) {
+ String workingSetName = w.getName();
mruList.add(workingSetName);
- mruList.setData(workingSetName, workingSets[i]);
+ mruList.setData(workingSetName, w);
}
if (workingSets.length > 0) {
mruList.setText(workingSets[0].getName());
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
index 994318bf7..dad03bebf 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
@@ -56,8 +56,8 @@ public class AddAction extends WorkspaceTraversalAction {
// TODO: What about non-root resources that are part of the model but would be ignored?
IResource[] resources = getSelectedResourcesWithOverlap();
boolean prompt = false;
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = getCVSResourceFor(resources[i]);
+ for (IResource r : resources) {
+ ICVSResource resource = getCVSResourceFor(r);
try {
if (resource.isIgnored()) {
prompt = true;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index 18d5ae8e3..c4d578cd5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -46,8 +46,7 @@ public class BranchAction extends WorkspaceTraversalAction {
private ResourceMapping[] getResourceMappings(IResource[] resources) {
List<ResourceMapping> mappings = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
Object o = getAdapter(resource, ResourceMapping.class);
if (o instanceof ResourceMapping) {
ResourceMapping mapping = (ResourceMapping) o;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index 3cc08cf6e..67b228fce 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -295,8 +295,8 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
return problems[0];
}
MultiStatus combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, getMultiStatusMessage(), null);
- for (int i = 0; i < problems.length; i++) {
- combinedStatus.merge(problems[i]);
+ for (IStatus problem : problems) {
+ combinedStatus.merge(problem);
}
return combinedStatus;
}
@@ -317,8 +317,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
List<IStatus> problems = new ArrayList<>();
IStatus[] status = getAccumulatedStatus();
if (status != null) {
- for (int i = 0; i < status.length; i++) {
- IStatus iStatus = status[i];
+ for (IStatus iStatus : status) {
if ( ! iStatus.isOK() || iStatus.getCode() == CVSStatus.SERVER_ERROR) {
problems.add(iStatus);
}
@@ -535,8 +534,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
final boolean[] result = new boolean[] { true };
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.getType() != IResource.PROJECT) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
index 839ada0e8..5f5f43d46 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
@@ -60,13 +60,11 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
private IResource[] getDeepResourcesToPatch(IProgressMonitor monitor) throws CoreException {
ResourceMapping[] mappings = getCVSResourceMappings();
List<IResource> roots = new ArrayList<>();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] traversals = mapping.getTraversals(
SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()),
monitor);
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
roots.addAll(Arrays.asList(resources));
@@ -74,8 +72,7 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
collectShallowFiles(resources, roots);
} else if (traversal.getDepth() == IResource.DEPTH_ONE) {
collectShallowFiles(resources, roots);
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
+ for (IResource resource : resources) {
if (resource.getType() != IResource.FILE) {
collectShallowFiles(members(resource), roots);
}
@@ -87,8 +84,7 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
}
private void collectShallowFiles(IResource[] resources, List<IResource> roots) {
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
+ for (IResource resource : resources) {
if (resource.getType() == IResource.FILE)
roots.add(resource);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
index 7d6bf572f..b5ad49493 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
@@ -54,8 +54,7 @@ public class IgnoreAction extends WorkspaceTraversalAction {
protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
try {
monitor.beginTask(null, resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
String pattern = dialog.getIgnorePatternFor(resource);
ICVSResource cvsResource = getCVSResourceFor(resource);
cvsResource.setIgnoredAs(pattern);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
index 69d8672d2..e8d43275c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
@@ -50,8 +50,7 @@ public class MoveRemoteTagAction extends TagInRepositoryAction {
private boolean isFolderSelected() {
ICVSResource[] resources = getSelectedCVSResources();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
+ for (ICVSResource resource : resources) {
if (resource.isFolder())
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index d94b4948b..d46e39232 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -100,8 +100,7 @@ public class SyncAction extends WorkspaceTraversalAction {
private IWorkingSet[] getSelectedWorkingSets() {
ResourceMapping[] mappings = getCVSResourceMappings();
List<IWorkingSet> sets = new ArrayList<>();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
if (mapping.getModelObject() instanceof IWorkingSet) {
IWorkingSet set = (IWorkingSet) mapping.getModelObject();
sets.add(set);
@@ -116,8 +115,7 @@ public class SyncAction extends WorkspaceTraversalAction {
private boolean includesAllCVSProjects(IResource[] resources) {
// First, make sure all the selected thinsg are projects
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.getType() != IResource.PROJECT)
return false;
}
@@ -128,8 +126,7 @@ public class SyncAction extends WorkspaceTraversalAction {
private IProject[] getAllCVSProjects() {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
Set<IProject> cvsProjects = new HashSet<>();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
if (RepositoryProvider.isShared(project) && RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) != null) {
cvsProjects.add(project);
}
@@ -148,8 +145,7 @@ public class SyncAction extends WorkspaceTraversalAction {
if (!isShowModelSync())
return true;
IModelProviderDescriptor[] descriptors = ModelProvider.getModelProviderDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- IModelProviderDescriptor descriptor = descriptors[i];
+ for (IModelProviderDescriptor descriptor : descriptors) {
try {
IResource[] resources = descriptor.getMatchingResources(new IResource[] { file });
if (resources.length > 0) {
@@ -158,14 +154,11 @@ public class SyncAction extends WorkspaceTraversalAction {
// However, we do not have a progress monitor so we'll just use a local context since,
// it is unlikely that a model element will consist of one file locally but multiple files remotely
ResourceMapping[] mappings = provider.getMappings(file, ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int j = 0; j < mappings.length; j++) {
- ResourceMapping mapping = mappings[j];
+ for (ResourceMapping mapping : mappings) {
ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int k = 0; k < traversals.length; k++) {
- ResourceTraversal traversal = traversals[k];
+ for (ResourceTraversal traversal : traversals) {
IResource[] tResources = traversal.getResources();
- for (int index = 0; index < tResources.length; index++) {
- IResource tr = tResources[index];
+ for (IResource tr : tResources) {
if (!tr.equals(file))
return false;
}
@@ -269,12 +262,11 @@ public class SyncAction extends WorkspaceTraversalAction {
if(sets == null)
return projects;
- for (int i = 0; i < sets.length; i++) {
- IAdaptable ad[] = sets[i].getElements();
+ for (IWorkingSet set : sets) {
+ IAdaptable[] ad = set.getElements();
if (ad != null) {
- for (int j = 0; j < ad.length; j++) {
- IResource resource = ad[j]
- .getAdapter(IResource.class);
+ for (IAdaptable a : ad) {
+ IResource resource = a.getAdapter(IResource.class);
if (resource != null) {
projects.add(resource.getProject());
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index b6ee44b18..9056ad357 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -134,8 +134,7 @@ public abstract class TagAction extends WorkspaceTraversalAction {
@Override
public void run(IProgressMonitor monitor) {
try {
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
+ for (ICVSResource resource : resources) {
// Cache the new tag creation even if the tag may have had warnings.
manager.addTags(getRootParent(resource), new CVSTag[] {tag});
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
index 099bfacda..324b362d3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
@@ -24,8 +24,10 @@ public class TagInRepositoryAction extends TagAction {
public boolean isEnabled() {
ICVSResource[] resources = getSelectedCVSResources();
if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof ICVSRepositoryLocation) return false;
+ for (ICVSResource resource : resources) {
+ if (resource instanceof ICVSRepositoryLocation) {
+ return false;
+ }
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
index 7f64b1dd0..b08fab021 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
@@ -77,8 +77,7 @@ public abstract class WorkspaceAction extends CVSAction {
private boolean handleOrphanedSubtrees() {
// invoke the inherited method so that overlaps are maintained
IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
handleOrphanedSubtree(resource);
}
return false;
@@ -169,8 +168,7 @@ public abstract class WorkspaceAction extends CVSAction {
if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
// determine the projects of the resources involved
Set<IProject> projects = new HashSet<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
projects.add(resource.getProject());
}
// prompt to refresh
@@ -302,9 +300,7 @@ public abstract class WorkspaceAction extends CVSAction {
// validate enabled for each resource in the selection
List<IPath> folderPaths = new ArrayList<>();
List<IPath> filePaths = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
+ for (IResource resource : resources) {
// only enable for accessible resources
if(resource.getType() == IResource.PROJECT) {
if (! resource.isAccessible()) return false;
@@ -464,16 +460,16 @@ public abstract class WorkspaceAction extends CVSAction {
boolean sameTagType = true;
boolean multipleSameNames = true;
- for (int i = 0; i < resources.length; i++) {
- ICVSResource cvsResource = getCVSResourceFor(resources[i]);
+ for (IResource resource : resources) {
+ ICVSResource cvsResource = getCVSResourceFor(resource);
CVSTag tag = null;
- if(cvsResource.isFolder()) {
+ if (cvsResource.isFolder()) {
FolderSyncInfo info = ((ICVSFolder)cvsResource).getFolderSyncInfo();
if(info != null) {
tag = info.getTag();
}
if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(resources[i], tag);
+ tag = Util.getAccurateFolderTag(resource, tag);
}
} else {
tag = CVSAction.getAccurateFileTag(cvsResource);
@@ -535,8 +531,7 @@ public abstract class WorkspaceAction extends CVSAction {
monitor = Policy.monitorFor(monitor);
monitor.beginTask(null, selectedResources.length * 100);
monitor.setTaskName(CVSUIMessages.ReplaceWithAction_calculatingDirtyResources);
- for (int i = 0; i < selectedResources.length; i++) {
- IResource resource = selectedResources[i];
+ for (IResource resource : selectedResources) {
ICVSResource cvsResource = getCVSResourceFor(resource);
if(cvsResource.isModified(Policy.subMonitorFor(monitor, 100))) {
dirtyResources.add(resource);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
index 31a978cd6..430738ee6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
@@ -66,11 +66,9 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
private static IResource[] getRootTraversalResources(ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException {
Set<IResource> result = new HashSet<>();
ResourceTraversal[] traversals = getTraversals(null, manager, monitor);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
+ for (IResource resource : resources) {
if (RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) != null) {
result.add(resource);
}
@@ -122,8 +120,7 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
public static IResource[] getProjects(IResource[] resources) {
Set<IProject> projects = new HashSet<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
projects.add(resource.getProject());
}
return projects.toArray(new IResource[projects.size()]);
@@ -138,8 +135,7 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
*/
@Deprecated
public static boolean isLogicalModel(ResourceMapping[] mappings) {
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
+ for (ResourceMapping mapping : mappings) {
if (! (mapping.getModelObject() instanceof IResource) ) {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
index b78d38f77..b04efa6f6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
@@ -40,9 +40,10 @@ public class CVSConsoleFactory implements IConsoleFactory {
IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
IConsole[] existing = manager.getConsoles();
boolean exists = false;
- for (int i = 0; i < existing.length; i++) {
- if(console == existing[i])
+ for (IConsole e : existing) {
+ if (console == e) {
exists = true;
+ }
}
if(! exists)
manager.addConsoles(new IConsole[] {console});
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
index 962c76e19..e1e3e1f9b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
@@ -95,8 +95,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
public class MyLifecycle implements org.eclipse.ui.console.IConsoleListener {
@Override
public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if (console == CVSOutputConsole.this) {
init();
}
@@ -105,8 +104,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
}
@Override
public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if (console == CVSOutputConsole.this) {
ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
dispose();
@@ -191,8 +189,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
synchronized(document) {
visible = true;
ConsoleDocument.ConsoleLine[] lines = document.getLines();
- for (int i = 0; i < lines.length; i++) {
- ConsoleDocument.ConsoleLine line = lines[i];
+ for (ConsoleDocument.ConsoleLine line : lines) {
appendLine(line.type, line.line);
}
document.clear();
@@ -328,8 +325,8 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
// Include child status
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- outputStatus(children[i], true, nestingLevel);
+ for (IStatus c : children) {
+ outputStatus(c, true, nestingLevel);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
index 38d60aaeb..46e0942c7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
@@ -79,8 +79,7 @@ public abstract class AbstractCommitAction extends CVSModelProviderAction {
public static IResource[] getOutgoingChanges(final IResourceDiffTree tree, ResourceTraversal[] traversals, IProgressMonitor monitor) {
final List<IResource> resources = new ArrayList<>();
IDiff[] diffs = tree.getDiffs(traversals);
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
if (hasLocalChange(diff)) {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource != null)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java
index 497c50608..b05486035 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelProviderAction.java
@@ -72,17 +72,14 @@ public abstract class CVSModelProviderAction extends ResourceModelParticipantAct
IStructuredSelection selection = getStructuredSelection();
Object[] objects = selection.toArray();
Set<IResource> roots = new HashSet<>();
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
+ for (Object object : objects) {
ResourceMapping mapping = Utils.getResourceMapping(object);
if (mapping != null) {
try {
ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
+ for (ResourceTraversal traversal : traversals) {
IResource[] resources = traversal.getResources();
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
+ for (IResource resource : resources) {
roots.add(resource);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java
index 21aebca24..1d29141cf 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSModelSynchronizeParticipant.java
@@ -52,8 +52,7 @@ public abstract class CVSModelSynchronizeParticipant extends ModelSynchronizePar
public ModelProvider[] getEnabledModelProviders() {
ModelProvider[] enabledProviders = super.getEnabledModelProviders();
if (this instanceof IChangeSetProvider) {
- for (int i = 0; i < enabledProviders.length; i++) {
- ModelProvider provider = enabledProviders[i];
+ for (ModelProvider provider : enabledProviders) {
if (provider.getId().equals(ChangeSetModelProvider.ID))
return enabledProviders;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
index 93751c354..0056264dc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
@@ -125,8 +125,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
// the local file
List<IDiff> fileDeletions = new ArrayList<>();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource.getType() == IResource.FILE) {
if (isIncomingDeletion(diff, ignoreLocalChanges)) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
index 1359a2098..b27c5359b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
@@ -124,8 +124,8 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
} else {
ChangeSet[] sets = getActiveChangeSetManager().getSets();
IResource[] resources = getResources(diffArray);
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet activeSet = (ActiveChangeSet) sets[i];
+ for (ChangeSet s : sets) {
+ ActiveChangeSet activeSet = (ActiveChangeSet) s;
activeSet.remove(resources);
}
}
@@ -188,8 +188,8 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
IDiff[] diffArray = getLocalChanges(getStructuredSelection());
ChangeSet[] sets = getActiveChangeSetManager().getSets();
IResource[] resources = getResources(diffArray);
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet activeSet = (ActiveChangeSet) sets[i];
+ for (ChangeSet set : sets) {
+ ActiveChangeSet activeSet = (ActiveChangeSet) set;
activeSet.remove(resources);
}
}
@@ -336,8 +336,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
private IResource[] getResources(IDiff[] diffArray) {
List<IResource> result = new ArrayList<>();
- for (int i = 0; i < diffArray.length; i++) {
- IDiff diff = diffArray[i];
+ for (IDiff diff : diffArray) {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource != null) {
result.add(resource);
@@ -392,8 +391,8 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
createChangeSet.selectionChanged(selection);
manager.add(createChangeSet);
manager.add(new Separator());
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet) sets[i];
+ for (ChangeSet s : sets) {
+ ActiveChangeSet set = (ActiveChangeSet) s;
AddToChangeSetAction action = new AddToChangeSetAction(
getSynchronizePageConfiguration(), set, selection);
manager.add(action);
@@ -458,11 +457,9 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
ITreeSelection ts = (ITreeSelection) selection;
TreePath[] paths = ts.getPaths();
List<IDiff> result = new ArrayList<>();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
+ for (TreePath path : paths) {
IDiff[] diffs = getLocalChanges(path);
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
+ for (IDiff diff : diffs) {
result.add(diff);
}
}
@@ -489,10 +486,11 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
IDiff[] diffArray = getLocalChanges(selection);
ChangeSet[] activeChangeSets = getActiveChangeSetManager().getSets();
IResource[] resources = getResources(diffArray);
- for (int i = 0; i < activeChangeSets.length; i++) {
- for (int j = 0; j < resources.length; j++) {
- if (activeChangeSets[i].contains(resources[j]))
+ for (ChangeSet activeChangeSet : activeChangeSets) {
+ for (IResource resource : resources) {
+ if (activeChangeSet.contains(resource)) {
return false;
+ }
}
}
return true;
@@ -502,8 +500,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
if (selection instanceof ITreeSelection) {
ITreeSelection ts = (ITreeSelection) selection;
TreePath[] paths = ts.getPaths();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
+ for (TreePath path : paths) {
if (!containsOnlyLocalChanges(path)) {
return false;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
index 3f4d38414..8d47e6365 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
@@ -96,8 +96,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private void handleSetRemoval(final ChangeSet set) {
IResource[] resources = set.getResources();
List toAdd = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff diff = getContext().getDiffTree().getDiff(resource);
if (diff != null && !isContainedInSet(diff))
toAdd.add(diff);
@@ -136,8 +135,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private void handleSetChange(final ChangeSet set, final IPath[] paths) {
try {
getTheRest().beginInput();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
boolean isContained = ((DiffChangeSet)set).contains(path);
if (isContained) {
IDiff diff = ((DiffChangeSet)set).getDiffTree().getDiff(path);
@@ -174,8 +172,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
if (visibleRemovedSets.length > 0)
((AbstractTreeViewer) getViewer()).remove(visibleRemovedSets);
- for (int i = 0; i < visibleChangedSets.length; i++) {
- ChangeSet set = visibleChangedSets[i];
+ for (ChangeSet set : visibleChangedSets) {
((AbstractTreeViewer) getViewer()).refresh(set, true);
}
} finally {
@@ -185,8 +182,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
try {
getTheRest().beginInput();
- for (int i = 0; i < addedSets.length; i++) {
- ChangeSet set = addedSets[i];
+ for (ChangeSet set : addedSets) {
handleSetAddition(set);
}
if (removedSets.length > 0) {
@@ -196,16 +192,14 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
// See bug 173138
addAllUnassignedToUnassignedSet();
}
- for (int i = 0; i < changedSets.length; i++) {
- ChangeSet set = changedSets[i];
+ for (ChangeSet set : changedSets) {
IPath[] paths = event.getChangesFor(set);
if (event.getSource().contains(set)) {
handleSetChange(set, paths);
} else {
try {
getTheRest().beginInput();
- for (int j = 0; j < paths.length; j++) {
- IPath path = paths[j];
+ for (IPath path : paths) {
IDiff diff = getContext().getDiffTree().getDiff(path);
if (diff != null && !isContainedInSet(diff))
getTheRest().add(diff);
@@ -222,8 +216,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private ChangeSet[] getVisibleSets(ChangeSet[] sets) {
List result = new ArrayList(sets.length);
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (isVisibleInMode(set)) {
result.add(set);
}
@@ -316,8 +309,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
List result = new ArrayList();
ChangeSet[] sets = getAllSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (hasChildren(TreePath.EMPTY.createChildPath(set)))
result.add(set);
}
@@ -362,8 +354,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
*/
protected boolean isContainedInSet(IDiff diff) {
ChangeSet[] sets = getAllSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set.contains(ResourceDiffTree.getResourceFor(diff))) {
return true;
}
@@ -405,8 +396,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
Object[] children = getChildren(parent);
Set result = new HashSet();
- for (int i = 0; i < children.length; i++) {
- Object child = children[i];
+ for (Object child : children) {
if (isVisible(child, diffTree)) {
result.add(child);
}
@@ -478,8 +468,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return true;
int depth = getTraversalCalculator().getLayoutDepth(resource, null);
IDiff[] diffs = tree.getDiffs(resource, depth);
- for (int i = 0; i < diffs.length; i++) {
- IDiff child = diffs[i];
+ for (IDiff child : diffs) {
if (isVisible(child)) {
return true;
}
@@ -501,8 +490,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private boolean hasChildrenInContext(ChangeSet set) {
IResource[] resources = set.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (getContext().getDiffTree().getDiff(resource) != null)
return true;
}
@@ -519,8 +507,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
DiffChangeSet[] sets = getSetsContaining(resource);
if (sets.length > 0) {
List result = new ArrayList();
- for (int i = 0; i < sets.length; i++) {
- DiffChangeSet set = sets[i];
+ for (DiffChangeSet set : sets) {
TreePath path = getPathForElement(set, resource.getParent());
if (path != null)
result.add(path);
@@ -539,8 +526,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private DiffChangeSet[] getSetsContaining(IResource resource) {
List result = new ArrayList();
DiffChangeSet[] allSets = getAllSets();
- for (int i = 0; i < allSets.length; i++) {
- DiffChangeSet set = allSets[i];
+ for (DiffChangeSet set : allSets) {
if (isVisible(resource, set.getDiffTree())) {
result.add(set);
}
@@ -559,15 +545,13 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
if (csc.supportsActiveChangeSets()) {
ActiveChangeSetManager collector = csc.getActiveChangeSetManager();
ChangeSet[] sets = collector.getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
result.add(set);
}
}
if (checkedInCollector != null) {
ChangeSet[] sets = checkedInCollector.getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
result.add(set);
}
}
@@ -698,19 +682,16 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
// Only adjust the set of the rest. The others will be handled by the collectors
try {
getTheRest().beginInput();
- for (int i = 0; i < removed.length; i++) {
- IPath path = removed[i];
+ for (IPath path : removed) {
getTheRest().remove(path);
}
- for (int i = 0; i < added.length; i++) {
- IDiff diff = added[i];
+ for (IDiff diff : added) {
// Only add the diff if it is not already in another set
if (!isContainedInSet(diff)) {
getTheRest().add(diff);
}
}
- for (int i = 0; i < changed.length; i++) {
- IDiff diff = changed[i];
+ for (IDiff diff : changed) {
// Only add the diff if it is already contained in the free set
if (getTheRest().getDiff(diff.getPath()) != null) {
getTheRest().add(diff);
@@ -740,11 +721,9 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private ChangeSet[] getSetsShowingPropogatedStateFrom(IPath[] paths) {
Set result = new HashSet();
- for (int i = 0; i < paths.length; i++) {
- IPath path = paths[i];
+ for (IPath path : paths) {
ChangeSet[] sets = getSetsShowingPropogatedStateFrom(path);
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
+ for (ChangeSet set : sets) {
result.add(set);
}
}
@@ -754,8 +733,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
protected DiffChangeSet[] getSetsShowingPropogatedStateFrom(IPath path) {
List result = new ArrayList();
DiffChangeSet[] allSets = getAllSets();
- for (int i = 0; i < allSets.length; i++) {
- DiffChangeSet set = allSets[i];
+ for (DiffChangeSet set : allSets) {
if (set.getDiffTree().getDiff(path) != null || set.getDiffTree().getChildren(path).length > 0) {
result.add(set);
}
@@ -777,8 +755,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
Tree tree = viewer.getTree();
TreeItem[] children = tree.getItems();
Set result = new HashSet();
- for (int i = 0; i < children.length; i++) {
- TreeItem control = children[i];
+ for (TreeItem control : children) {
Object data = control.getData();
if (data instanceof ChangeSet) {
ChangeSet set = (ChangeSet) data;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java
index a989ed50c..be2d5f664 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetLabelProvider.java
@@ -99,8 +99,7 @@ public class ChangeSetLabelProvider extends ResourceModelLabelProvider {
if (element instanceof DiffChangeSet) {
DiffChangeSet dcs = (DiffChangeSet) element;
IResource[] resources = dcs.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (getContext().getDiffTree().getProperty(resource.getFullPath(), IDiffTree.P_BUSY_HINT))
return true;
}
@@ -114,8 +113,7 @@ public class ChangeSetLabelProvider extends ResourceModelLabelProvider {
if (element instanceof DiffChangeSet) {
DiffChangeSet dcs = (DiffChangeSet) element;
IResource[] resources = dcs.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (getContext().getDiffTree().getProperty(resource.getFullPath(), IDiffTree.P_HAS_DESCENDANT_CONFLICTS))
return true;
}
@@ -149,8 +147,7 @@ public class ChangeSetLabelProvider extends ResourceModelLabelProvider {
Set projects = new HashSet();
IResource[] resources = dcs.getResources();
int severity = -1;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IProject project = resource.getProject();
if (!projects.contains(project)) {
projects.add(project);
@@ -172,14 +169,12 @@ public class ChangeSetLabelProvider extends ResourceModelLabelProvider {
private Object[] addSetsContainingElements(Object[] elements) {
Set result = new HashSet();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
+ for (Object object : elements) {
result.add(object);
if (object instanceof IProject) {
IProject project = (IProject) object;
ChangeSet[] sets = getSetsContaing(project);
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
+ for (ChangeSet set : sets) {
result.add(set);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java
index 756524d24..4590d1690 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CheckedInChangeSetCollector.java
@@ -86,18 +86,15 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
private IPath[] getAffectedPaths(IDiffChangeEvent event) {
Set<IPath> result = new HashSet<>();
IPath[] removed = event.getRemovals();
- for (int i = 0; i < removed.length; i++) {
- IPath path = removed[i];
+ for (IPath path : removed) {
result.add(path);
}
IDiff[] diffs = event.getAdditions();
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
+ for (IDiff diff : diffs) {
result.add(diff.getPath());
}
diffs = event.getChanges();
- for (int j = 0; j < diffs.length; j++) {
- IDiff diff = diffs[j];
+ for (IDiff diff : diffs) {
result.add(diff.getPath());
}
return result.toArray(new IPath[result.size()]);
@@ -144,8 +141,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
protected ChangeSet getChangeSet(IDiffTree tree) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet changeSet = sets[i];
+ for (ChangeSet changeSet : sets) {
if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
return changeSet;
}
@@ -159,8 +155,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
removals.addAll(Arrays.asList(event.getRemovals()));
additions.addAll(Arrays.asList(event.getAdditions()));
IDiff[] changed = event.getChanges();
- for (int i = 0; i < changed.length; i++) {
- IDiff diff = changed[i];
+ for (IDiff diff : changed) {
additions.add(diff);
removals.add(diff.getPath());
}
@@ -174,8 +169,8 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
protected void remove(IPath[] paths) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- DiffChangeSet set = (DiffChangeSet)sets[i];
+ for (ChangeSet s : sets) {
+ DiffChangeSet set = (DiffChangeSet) s;
set.remove(paths);
}
}
@@ -222,8 +217,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
private SyncInfo[] getSyncInfos(IDiff[] diffs) {
SyncInfoSet set = new SyncInfoSet();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
set.add(getConverter().asSyncInfo(diff, getSubscriber().getResourceComparator()));
}
return set.getSyncInfos();
@@ -282,8 +276,8 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
try {
monitor.beginTask(null, commentInfos.length * 10);
if (logs != null) {
- for (int i = 0; i < commentInfos.length; i++) {
- addSyncInfoToCommentNode(commentInfos[i], logs);
+ for (SyncInfo commentInfo : commentInfos) {
+ addSyncInfoToCommentNode(commentInfo, logs);
monitor.worked(10);
}
}
@@ -326,8 +320,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
String remoteRevision = ((ICVSRemoteFile) remoteResource).getRevision();
if (isDeletedRemotely(info)) {
ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
+ for (ILogEntry entry : logEntries) {
String revision = entry.getRevision();
if (entry.isDeletion() && ResourceSyncInfo.isLaterRevision(revision, remoteRevision)) {
logEntry = entry;
@@ -355,8 +348,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
// remote.
addRemoteChange(info, null, null);
} else {
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
+ for (ILogEntry entry : logEntries) {
addRemoteChange(info, remoteResource, entry);
}
}
@@ -418,8 +410,7 @@ public class CheckedInChangeSetCollector extends BatchingChangeSetManager implem
private CVSCheckedInChangeSet getChangeSetFor(ILogEntry logEntry) {
ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
+ for (ChangeSet set : sets) {
if (set instanceof CVSCheckedInChangeSet &&
set.getComment().equals(logEntry.getComment()) &&
((CVSCheckedInChangeSet)set).getAuthor().equals(logEntry.getAuthor())) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
index 63a741698..b5290422f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
@@ -55,8 +55,7 @@ public class CreatePatchAction extends CVSModelProviderAction implements IDiffCh
final Set resources = new HashSet();
final IResourceDiffTree diffTree = getSynchronizationContext().getDiffTree();
IDiff[] diffs = diffTree.getDiffs(traversals);
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
IResource child = diffTree.getResource(diff);
if (child.getType() == IResource.FILE && diff instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
index 82f746f13..65e370e3e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
@@ -57,8 +57,7 @@ public class MergeSubscriberContext extends CVSSubscriberMergeContext {
public void markAsMerged(final IDiff[] diffs, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
run(monitor1 -> {
List<IResource> result = new ArrayList<>();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
result.add(getDiffTree().getResource(diff));
}
((CVSMergeSubscriber) getSubscriber()).merged(result.toArray(new IResource[result.size()]));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java
index 8503f363f..8021bdb2c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelMergeParticipant.java
@@ -149,8 +149,7 @@ public class ModelMergeParticipant extends CVSModelSynchronizeParticipant {
}
List<IResource> resources = new ArrayList<>();
- for (int i = 0; i < rootNodes.length; i++) {
- IMemento rootNode = rootNodes[i];
+ for (IMemento rootNode : rootNodes) {
IPath path = new Path(rootNode.getString(CTX_ROOT_PATH));
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
if(resource != null) {
@@ -178,8 +177,7 @@ public class ModelMergeParticipant extends CVSModelSynchronizeParticipant {
// resource roots
IResource[] roots = s.roots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
IMemento rootNode = memento.createChild(CTX_ROOT);
rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
}
@@ -221,8 +219,7 @@ public class ModelMergeParticipant extends CVSModelSynchronizeParticipant {
*/
public static ModelMergeParticipant getMatchingParticipant(ResourceMapping[] mappings, CVSTag startTag, CVSTag endTag) {
ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
+ for (ISynchronizeParticipantReference reference : refs) {
if (reference.getId().equals(ID)) {
ModelMergeParticipant p;
try {
@@ -234,9 +231,7 @@ public class ModelMergeParticipant extends CVSModelSynchronizeParticipant {
ResourceMapping[] roots = scope.getMappings();
if (roots.length == mappings.length) {
boolean match = true;
- for (int j = 0; j < mappings.length; j++) {
-
- ResourceMapping mapping = mappings[j];
+ for (ResourceMapping mapping : mappings) {
if (scope.getTraversals(mapping) == null) {
// The mapping is not in the scope so the participants don't match
match = false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
index 8c68411bd..20e39e040 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelUpdateOperation.java
@@ -88,10 +88,9 @@ public class ModelUpdateOperation extends AbstractModelMergeOperation {
ct.addTraversals(getContext().getScope().getTraversals());
IResource[] roots = ct.getRoots();
List<ICVSResource> cvsResources = new ArrayList<>();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
+ for (IResource resource : roots) {
if (resource.getProject().isAccessible()) {
- cvsResources.add(CVSWorkspaceRoot.getCVSResourceFor(roots[i]));
+ cvsResources.add(CVSWorkspaceRoot.getCVSResourceFor(resource));
}
}
new PruneFolderVisitor().visit(
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
index 58b40232e..54ae477c1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
@@ -128,8 +128,7 @@ class OpenChangeSetAction extends ResourceModelParticipantAction {
* Build the trees that will be compared
*/
private boolean buildTrees(CompareTreeBuilder builder, IDiff[] diffs) {
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
if (isFileChange(diff)) {
IFileRevision remoteRevision = Utils.getRemote(diff);
IResourceVariant remote = SyncInfoToDiffConverter.asResourceVariant(remoteRevision);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java
index 19ff7923d..67292b61e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceChangeSetCapability.java
@@ -53,8 +53,7 @@ public class WorkspaceChangeSetCapability extends ModelParticipantChangeSetCapab
private IResource[] getResources(IDiff[] diffs) {
Set<IResource> result = new HashSet<>();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource != null)
result.add(resource);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
index 257dc6d4e..3da350d41 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
@@ -174,8 +174,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
DiffTree tree = ((DiffTree)getDiffTree());
try {
tree.beginInput();
- for (int i = 0; i < nodes.length; i++) {
- IDiff diff = nodes[i];
+ for (IDiff diff : nodes) {
tree.remove(diff.getPath());
}
} finally {
@@ -466,8 +465,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
private ResourceTraversal[] getTraversals(IDiff[] deltas) {
List<IResource> result = new ArrayList<>();
- for (int i = 0; i < deltas.length; i++) {
- IDiff diff = deltas[i];
+ for (IDiff diff : deltas) {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource != null) {
result.add(resource);
@@ -480,8 +478,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
private IResourceDiffTree getDiffTree(IDiff[] deltas) {
ResourceDiffTree tree = new ResourceDiffTree();
- for (int i = 0; i < deltas.length; i++) {
- IDiff diff = deltas[i];
+ for (IDiff diff : deltas) {
tree.add(diff);
}
return tree;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
index 342d709a1..f858a9e00 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
@@ -139,9 +139,9 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
try {
ILogEntry[] entries = file.getLogEntries(monitor);
String revision = file.getRevision();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revision)) {
- entry = entries[i];
+ for (ILogEntry e : entries) {
+ if (e.getRevision().equals(revision)) {
+ entry = e;
return;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
index 7c596c2d1..e3eaeb93c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
@@ -114,8 +114,7 @@ public class RemoteContentProvider extends WorkbenchContentProvider {
}
}
Object[] children = super.getChildren(element);
- for (int i = 0; i < children.length; i++) {
- Object object = children[i];
+ for (Object object : children) {
if (object instanceof CVSModelElement)
((CVSModelElement)object).setWorkingSet(getWorkingSet());
}
@@ -124,8 +123,7 @@ public class RemoteContentProvider extends WorkbenchContentProvider {
public void cancelJobs(RepositoryRoot[] roots) {
if (manager != null) {
- for (int i = 0; i < roots.length; i++) {
- RepositoryRoot root = roots[i];
+ for (RepositoryRoot root : roots) {
cancelJobs(root.getRoot());
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
index 7919b5806..2cad69889 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
@@ -104,10 +104,7 @@ public class AddOperation extends RepositoryProviderOperation {
// and the depth isn't zero
final Map /* from KSubstOption to Set */<KSubstOption, Set> files = new HashMap<>();
final CVSException[] eHolder = new CVSException[1];
- for (int i=0; i<resources.length; i++) {
-
- final IResource currentResource = resources[i];
-
+ for (IResource currentResource : resources) {
try {
// Auto-add parents if they are not already managed
IContainer parent = currentResource.getParent();
@@ -181,20 +178,19 @@ public class AddOperation extends RepositoryProviderOperation {
session.close();
}
}
- for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
+ for (Map.Entry entry : files.entrySet()) {
final KSubstOption ksubst = (KSubstOption) entry.getKey();
final Set set = (Set) entry.getValue();
Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
try {
IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { ksubst },
- (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] { ksubst },
+ (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
+ null,
+ Policy.subMonitorFor(progress, 8));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
index 4e350b773..b501d92b8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
@@ -219,8 +219,8 @@ public class BranchOperation extends RepositoryProviderOperation {
// Visit all the children folders in order to set the root in the folder sync
// info
- for (int i = 0; i < resources.length; i++) {
- CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(new ICVSResourceVisitor() {
+ for (IResource resource : resources) {
+ CVSWorkspaceRoot.getCVSResourceFor(resource).accept(new ICVSResourceVisitor() {
@Override
public void visitFile(ICVSFile file) throws CVSException {
monitor1.worked(1);
@@ -255,10 +255,9 @@ public class BranchOperation extends RepositoryProviderOperation {
private void updateRememberedTags(IResource[] providerResources) throws CVSException {
if (rootVersionTag != null || update) {
- for (int i = 0; i < providerResources.length; i++) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResources[i]);
+ for (IResource providerResource : providerResources) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResource);
RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
-
if (rootVersionTag != null) {
manager.addTags(cvsResource, new CVSTag[] { rootVersionTag });
}
@@ -283,8 +282,10 @@ public class BranchOperation extends RepositoryProviderOperation {
* Answers <code>true</code> if all resources in the array have a sticky tag
*/
private boolean areAllResourcesSticky(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- if(!hasStickyTag(resources[i])) return false;
+ for (IResource resource : resources) {
+ if (!hasStickyTag(resource)) {
+ return false;
+ }
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
index 5030bfad1..335262329 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
@@ -154,8 +154,7 @@ public abstract class CVSOperation extends TeamOperation implements IShellProvid
throw new CVSException(errors[0]);
}
MultiStatus result = new MultiStatus(CVSUIPlugin.ID, 0, getErrorMessage(errors, statusCount), null);
- for (int i = 0; i < errors.length; i++) {
- IStatus s = errors[i];
+ for (IStatus s : errors) {
if (s.isMultiStatus()) {
result.add(new CVSStatus(s.getSeverity(), s.getMessage(), s.getException()));
result.addAll(s);
@@ -178,14 +177,12 @@ public abstract class CVSOperation extends TeamOperation implements IShellProvid
// We are only concerned with reportable errors.
// Others will appear in the console
List<IStatus> reportableErrors = new ArrayList<>();
- for (int i = 0; i < errors.length; i++) {
- IStatus status = errors[i];
+ for (IStatus status : errors) {
if (isReportableError(status)) {
reportableErrors.add(status);
} else if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int j = 0; j < children.length; j++) {
- IStatus child = children[j];
+ for (IStatus child : children) {
if (isReportableError(child)) {
reportableErrors.add(status);
break;
@@ -262,8 +259,7 @@ public abstract class CVSOperation extends TeamOperation implements IShellProvid
if (isReportableError(status)) return true;
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int j = 0; j < children.length; j++) {
- IStatus child = children[j];
+ for (IStatus child : children) {
if (isReportableError(child)) {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
index 1fc91f696..27c970d50 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
@@ -75,11 +75,9 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
private IResource[] getFilesWithLocalChanges(IResource[] resources, boolean recurse) {
ArrayList<IResource> result = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff[] nodes = getTree().getDiffs(resource, recurse ? IResource.DEPTH_INFINITE: IResource.DEPTH_ONE);
- for (int j = 0; j < nodes.length; j++) {
- IDiff node = nodes[j];
+ for (IDiff node : nodes) {
if (isFileWithLocalChange(node)) {
result.add(getTree().getResource(node));
}
@@ -102,8 +100,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
folder.run(monitor1 -> {
monitor1.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.exists() && resource.getType() == IResource.FILE) {
IResourceVariant remoteResource = (IResourceVariant) CVSWorkspaceRoot
.getRemoteResourceFor(resource);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
index b0955b832..add9d7e5a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
@@ -58,11 +58,9 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation
private IResource[] getFilesWithUncachedContents(IResource[] resources, boolean recurse) {
ArrayList<IResource> result = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff[] nodes = tree.getDiffs(resource, recurse ? IResource.DEPTH_INFINITE: IResource.DEPTH_ONE);
- for (int j = 0; j < nodes.length; j++) {
- IDiff node = nodes[j];
+ for (IDiff node : nodes) {
if (needsContents(node)) {
result.add(tree.getResource(node));
}
@@ -129,8 +127,7 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation
@Override
protected ICVSResource[] getCVSArguments(Session session, IResource[] resources) {
List<ICVSResource> result = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
try {
ICVSResource file = session.getLocalRoot().getChild(resource.getProjectRelativePath().toString());
result.add(file);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
index 0eb05d5a5..b314a6c69 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
@@ -135,8 +135,8 @@ public class CheckoutIntoOperation extends CheckoutOperation {
// Convert the module expansions to target folders
String[] expansions = session.getModuleExpansions();
- for (int j = 0; j < expansions.length; j++) {
- String childPath = new Path(null, expansions[j]).segment(0);
+ for (String expansion : expansions) {
+ String childPath = new Path(null, expansion).segment(0);
ICVSResource resource = parentFolder.getChild(childPath);
if (resource != null && !resource.isFolder()) {
// The target folder conflicts with an existing file
@@ -174,8 +174,7 @@ public class CheckoutIntoOperation extends CheckoutOperation {
* Ensure that the new folders will not conflict with existing folders (even those that are pruned).
*/
private IStatus validateTargetFolders(ICVSRemoteFolder remoteFolder, ICVSFolder[] targetFolders, IProgressMonitor monitor) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- ICVSFolder targetFolder = targetFolders[i];
+ for (ICVSFolder targetFolder : targetFolders) {
FolderSyncInfo localInfo = targetFolder.getFolderSyncInfo();
FolderSyncInfo remoteInfo = remoteFolder.getFolderSyncInfo();
@@ -274,15 +273,13 @@ public class CheckoutIntoOperation extends CheckoutOperation {
if (targetFolders.length > 1) {
setInvolvesMultipleResources(true);
}
- for (int i=0;i<targetFolders.length;i++) {
- ICVSFolder targetFolder = targetFolders[i];
+ for (ICVSFolder targetFolder : targetFolders) {
if (needsPromptForOverwrite(targetFolder, Policy.subMonitorFor(monitor, 50)) && !promptToOverwrite(targetFolder)) {
return new CVSStatus(IStatus.INFO, NLS.bind(CVSUIMessages.CheckoutIntoOperation_cancelled, new String[] { remoteFolder.getName() }));
}
}
-
- for (int i = 0; i < targetFolders.length; i++) {
- IStatus status = scrubFolder(targetFolders[i], Policy.subMonitorFor(monitor, 50));
+ for (ICVSFolder targetFolder : targetFolders) {
+ IStatus status = scrubFolder(targetFolder, Policy.subMonitorFor(monitor, 50));
if (!status.isOK()) return status;
}
monitor.done();
@@ -371,8 +368,8 @@ public class CheckoutIntoOperation extends CheckoutOperation {
}
private void manageFolders(ICVSFolder[] targetFolders, String root) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- manageFolder(targetFolders[i], root);
+ for (ICVSFolder targetFolder : targetFolders) {
+ manageFolder(targetFolder, root);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
index 863931ea3..6f2afc594 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
@@ -43,8 +43,7 @@ public abstract class CheckoutOperation extends RemoteOperation {
*/
protected void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
monitor.beginTask(null, folders.length * 100);
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
+ for (ICVSRemoteFolder folder : folders) {
IStatus result = checkout(folder, Policy.subMonitorFor(monitor, 100));
collectStatus(result);
Policy.checkCanceled(monitor);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index 23d0c5845..4c3988e08 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -175,8 +175,9 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
}
IWorkingSet[] ws = getWorkingSets();
if (ws != null) {
- for (int i = 0; i < ws.length; i++)
- createWorkingSet(ws[i].getName(), targetProjects);
+ for (IWorkingSet w : ws) {
+ createWorkingSet(w.getName(), targetProjects);
+ }
}
return result[0];
} catch (CVSException e) {
@@ -195,8 +196,8 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[0]);
} else {
Set<ISchedulingRule> rules = new HashSet<>();
- for (int i = 0; i < projects.length; i++) {
- ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[i]);
+ for (IProject project : projects) {
+ ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project);
if (modifyRule instanceof IResource && ((IResource)modifyRule).getType() == IResource.ROOT) {
// One of the projects is mapped to a provider that locks the workspace.
// Just return the workspace root rule
@@ -326,8 +327,8 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
}
targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(lastSegment));
} else {
- for (int j = 0; j < expansions.length; j++) {
- targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansions[j]).segment(0)));
+ for (String expansion : expansions) {
+ targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansion).segment(0)));
}
}
@@ -361,8 +362,7 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
if (projects.length > 1) {
setInvolvesMultipleResources(true);
}
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
Policy.checkCanceled(monitor);
if (needsPromptForOverwrite(project) && !promptToOverwrite(remoteFolder, project)) {
// User said no to this project but not no to all
@@ -371,8 +371,7 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
}
// Create the projects and remove any previous content
monitor.beginTask(null, projects.length * 100);
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
createAndOpenProject(project, Policy.subMonitorFor(monitor, 10));
scrubProject(project, Policy.subMonitorFor(monitor, 90));
}
@@ -392,9 +391,9 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
monitor.beginTask(null, 100 + children.length * 100);
monitor.subTask(NLS.bind(CVSUIMessages.CheckoutOperation_scrubbingProject, new String[] { project.getName() })); //
try {
- for (int j = 0; j < children.length; j++) {
- if ( ! children[j].getName().equals(".project")) {//$NON-NLS-1$
- children[j].delete(true /*force*/, Policy.subMonitorFor(monitor, 100));
+ for (IResource child : children) {
+ if (!child.getName().equals(".project")) { //$NON-NLS-1$
+ child.delete(true /*force*/, Policy.subMonitorFor(monitor, 100));
}
}
// Make sure there is no sync info cached for the project since
@@ -480,8 +479,7 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
private void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CVSException {
monitor.beginTask(null, projects.length * 100);
try {
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ for (IProject project : projects) {
// Register the project with Team
try {
monitor.subTask(NLS.bind(CVSUIMessages.CheckoutOperation_refreshingProject, new String[] { project.getName() }));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
index 96ca3a870..37fb05a7b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
@@ -218,8 +218,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
monitor.beginTask(null,100);
final IProgressMonitor subMonitor = Policy.subMonitorFor(monitor,10);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
cvsResource.accept(new ICVSResourceVisitor() {
@Override
@@ -261,10 +260,9 @@ public abstract class DiffOperation extends SingleCommandOperation {
int format = STANDARD_FORMAT;
LocalOption[] localoptions = getLocalOptions(recurse);
- for (int i = 0; i < localoptions.length; i++) {
- LocalOption option = localoptions[i];
+ for (LocalOption option : localoptions) {
if (option.equals(Diff.UNIFIED_FORMAT) ||
- isMultiPatch) {
+ isMultiPatch) {
format = UNIFIED_FORMAT;
} else if (option.equals(Diff.CONTEXT_FORMAT)) {
format = CONTEXT_FORMAT;
@@ -338,15 +336,14 @@ public abstract class DiffOperation extends SingleCommandOperation {
List<IStatus> toShow = new ArrayList<>();
IStatus children[] = status.getChildren();
boolean may = true;
- for (int i = 0; i < children.length; i++) {
+ for (IStatus child : children) {
// ignore all errors except those found by DiffListener
- if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER
- || children[i].getCode() == CVSStatus.PROTOCOL_ERROR
- || children[i].getCode() == CVSStatus.ERROR_LINE) {
- toShow.add(children[i]);
- if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER)
+ if (child.getCode() == CVSStatus.BINARY_FILES_DIFFER || child.getCode() == CVSStatus.PROTOCOL_ERROR || child.getCode() == CVSStatus.ERROR_LINE) {
+ toShow.add(child);
+ if (child.getCode() == CVSStatus.BINARY_FILES_DIFFER) {
// the patch does not contain some changes for sure
may = false;
+ }
}
}
if (toShow.size() > 0) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
index df4b39a09..c95b5e0cb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
@@ -135,22 +135,18 @@ public class FetchAllMembersOperation extends RemoteOperation {
String[] entry = cache.getCachedFilePaths();
//Strip repo + project info from entries
RLogTreeBuilder treeBuilder = new RLogTreeBuilder(project.getRepository(),tag);
- for (int i = 0; i < entry.length; i++) {
- ILogEntry[] logEntry = cache.getLogEntries(entry[i]);
-
+ for (String e : entry) {
+ ILogEntry[] logEntry = cache.getLogEntries(e);
//might not have state if this a branch entry
if (logEntry[0].getState() != null &&
- logEntry[0].getState().equals(DEAD_STATE))
+ logEntry[0].getState().equals(DEAD_STATE))
continue;
-
-
ICVSRemoteFile remoteFile = logEntry[0].getRemoteFile();
//if the current folder tag is a branch tag, we need to take the extra step
//of making sure that the file's revision number has been set appropriately
if (tag.getType() == CVSTag.BRANCH &&
- remoteFile.getRevision().equals(LogListener.BRANCH_REVISION))
+ remoteFile.getRevision().equals(LogListener.BRANCH_REVISION))
verifyRevision(tag, logEntry[0], remoteFile);
-
IPath logPath = new Path(null,remoteFile.getRepositoryRelativePath());
if (logPath.segmentCount()>0)
logPath = logPath.removeFirstSegments(1);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
index 5e432a224..2242c5981 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
+++ b/