Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/TestUtils.java3
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java5
7 files changed, 14 insertions, 20 deletions
diff --git a/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/TestUtils.java b/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/TestUtils.java
index 569bf4e5e..a18cd8935 100644
--- a/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/TestUtils.java
+++ b/org.eclipse.egit.core.junit/src/org/eclipse/egit/core/test/TestUtils.java
@@ -242,8 +242,7 @@ public class TestUtils {
public void assertRepositoryContainsFiles(Repository repository,
String[] paths) throws Exception {
Set<String> expectedfiles = new HashSet<>();
- for (String path : paths)
- expectedfiles.add(path);
+ expectedfiles.addAll(Arrays.asList(paths));
try (TreeWalk treeWalk = new TreeWalk(repository)) {
treeWalk.addTree(repository.resolve("HEAD^{tree}"));
treeWalk.setRecursive(true);
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
index 317269326..e2a62e6fc 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
@@ -648,8 +648,7 @@ public class ResourceUtil {
}
final ResourceMapping[] modelMappings = model.getMappings(
resource, context, new NullProgressMonitor());
- for (ResourceMapping mapping : modelMappings)
- mappings.add(mapping);
+ mappings.addAll(Arrays.asList(modelMappings));
}
} catch (CoreException e) {
Activator.logError(e.getMessage(), e);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index d65c7d503..2551d908e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -160,7 +160,7 @@ public class TestUtil {
BundleContext context = bundle.getBundleContext();
ServiceTracker<BundleLocalization, BundleLocalization> localizationTracker =
- new ServiceTracker<BundleLocalization, BundleLocalization>(
+ new ServiceTracker<>(
context, BundleLocalization.class, null);
localizationTracker.open();
@@ -469,8 +469,7 @@ public class TestUtil {
public static void assertRepositoryContainsFiles(Repository repository,
String[] paths) throws Exception {
Set<String> expectedfiles = new HashSet<>();
- for (String path : paths)
- expectedfiles.add(path);
+ expectedfiles.addAll(Arrays.asList(paths));
try (TreeWalk treeWalk = new TreeWalk(repository)) {
treeWalk.addTree(repository.resolve("HEAD^{tree}"));
treeWalk.setRecursive(true);
@@ -555,7 +554,7 @@ public class TestUtil {
*/
public SWTBotTreeItem[] getProjectItems(SWTBotTree projectExplorerTree,
String... projects) {
- List<SWTBotTreeItem> items = new ArrayList<SWTBotTreeItem>();
+ List<SWTBotTreeItem> items = new ArrayList<>();
for (SWTBotTreeItem item : projectExplorerTree.getAllItems()) {
String itemText = item.getText();
StringTokenizer tok = new StringTokenizer(itemText, " ");
@@ -691,7 +690,7 @@ public class TestUtil {
*/
public static SWTBotTreeItem getNode(SWTBotTreeItem[] nodes, String searchText) {
List<String> texts = new ArrayList<>();
- List<SWTBotTreeItem> matchingItems = new ArrayList<SWTBotTreeItem>();
+ List<SWTBotTreeItem> matchingItems = new ArrayList<>();
for (SWTBotTreeItem item : nodes) {
String text = item.getText();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
index 24737b531..18393f875 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.test.stagview;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
@@ -60,9 +61,7 @@ public class TestCommitMessageProviderExtensionFactory
public void setCommitMessageProviders(
ICommitMessageProvider... newProviders) {
providers.clear();
- for (ICommitMessageProvider p : newProviders) {
- providers.add(p);
- }
+ providers.addAll(Arrays.asList(newProviders));
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
index 957917ecd..922c82da9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
@@ -14,6 +14,7 @@ package org.eclipse.egit.ui;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -476,8 +477,7 @@ public class UIUtils {
List<String> values = new ArrayList<>(
existingValues.length + 1);
- for (String existingValue : existingValues)
- values.add(existingValue);
+ values.addAll(Arrays.asList(existingValues));
// if it is already the first value, we don't need to do
// anything
if (values.indexOf(value) == 0)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
index 7b55ea278..fef6977f6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.components;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -198,9 +199,7 @@ public class CachedCheckboxTreeViewer extends ContainerCheckedTreeViewer {
}
if (contentProvider == null) {
- for (Object element : visible) {
- checkState.add(element);
- }
+ checkState.addAll(Arrays.asList(visible));
} else {
Set<Object> toCheck = new HashSet<>();
for (Object element : visible) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
index 2a07f4f4b..f187138ad 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
@@ -11,6 +11,7 @@
package org.eclipse.egit.ui.internal.dialogs;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
@@ -304,9 +305,7 @@ public class HyperlinkTokenScanner implements ITokenScanner {
IHyperlinkDetector[] configuredDetectors = configuration
.getHyperlinkDetectors(viewer);
if (configuredDetectors != null && configuredDetectors.length > 0) {
- for (IHyperlinkDetector detector : configuredDetectors) {
- allDetectors.add(detector);
- }
+ allDetectors.addAll(Arrays.asList(configuredDetectors));
if (preferenceStore.getBoolean(URL_HYPERLINK_DETECTOR_KEY)
|| !preferenceStore.getBoolean(
AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED)) {

Back to the top