Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-03-08 20:22:37 +0000
committerRobin Stocker2013-03-09 15:08:35 +0000
commit501b1b06ef984288bbf82b56cc012e01d8ba6f6b (patch)
treed0c1dc6a5fecd3178735d99256ff6452c47f1f9c /org.eclipse.egit.ui
parent739a416c175226bf62be309a3d9022d41fdde688 (diff)
downloadegit-501b1b06ef984288bbf82b56cc012e01d8ba6f6b.tar.gz
egit-501b1b06ef984288bbf82b56cc012e01d8ba6f6b.tar.xz
egit-501b1b06ef984288bbf82b56cc012e01d8ba6f6b.zip
Add instanceof check to fix unchecked conversion warning
Actually check the elements of the selection to make sure that the cast is right. Change-Id: I2ced1ec0ba982eaf6c7be3adf5f06e294e4588d3
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index ddbba52f0d..0e528ad39c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2011, 2012 Bernard Leach <leachbj@bouncycastle.org> and others.
+ * Copyright (C) 2011, 2013 Bernard Leach <leachbj@bouncycastle.org> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -1142,12 +1142,15 @@ public class StagingView extends ViewPart implements IShowInSource {
if (s.isEmpty() || !(s instanceof IStructuredSelection))
return;
final IStructuredSelection iss = (IStructuredSelection) s;
- for (Iterator<StagingEntry> it = iss.iterator(); it.hasNext();) {
- String relativePath = it.next().getPath();
- String path = new Path(currentRepository.getWorkTree()
- .getAbsolutePath()).append(relativePath)
- .toOSString();
- openFileInEditor(path);
+ for (Object element : iss.toList()) {
+ if (element instanceof StagingEntry) {
+ StagingEntry entry = (StagingEntry) element;
+ String relativePath = entry.getPath();
+ String path = new Path(currentRepository.getWorkTree()
+ .getAbsolutePath()).append(relativePath)
+ .toOSString();
+ openFileInEditor(path);
+ }
}
}

Back to the top