Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2015-04-18 09:43:12 +0000
committerAndrey Loskutov2015-04-18 09:43:12 +0000
commit0f95e0f39540971f8a5ea4da1d0b0f3d36c6d62e (patch)
tree785f588cd92f40e515b0a4e592d15b0486f5657d /org.eclipse.egit.ui.test
parent02f9ebaa09f8559bdc6731d975d735d4bbe4c67e (diff)
downloadegit-0f95e0f39540971f8a5ea4da1d0b0f3d36c6d62e.tar.gz
egit-0f95e0f39540971f8a5ea4da1d0b0f3d36c6d62e.tar.xz
egit-0f95e0f39540971f8a5ea4da1d0b0f3d36c6d62e.zip
Fix unnecessary cast errors from generified IAdaptable#getAdapter(..)
Bug: 460685 Change-Id: Iec050627f71b31f0b10b19771b67e5eb86f1aa86 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java13
3 files changed, 12 insertions, 9 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
index bcaed2bff9..c8907dac18 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
@@ -32,6 +32,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.JobFamilies;
+import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.operations.GitScopeOperation;
import org.eclipse.egit.ui.internal.operations.GitScopeOperationFactory;
@@ -230,7 +231,7 @@ public class GitScopeUtilTest extends LocalRepositoryTestCase {
}
private ResourceMapping getMappingAdapter(IResource resource) {
- return (ResourceMapping) resource.getAdapter(ResourceMapping.class);
+ return Utils.getAdapter(resource, ResourceMapping.class);
}
}
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
index 5a17851b53..fc71f8fd2d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
@@ -19,6 +19,7 @@ import java.io.File;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.UIText;
@@ -77,8 +78,8 @@ public class CommitEditorTest extends LocalRepositoryTestCase {
assertNotNull(editorRef.get());
IEditorPart editor = editorRef.get();
assertTrue(editor instanceof CommitEditor);
- RepositoryCommit adaptedCommit = (RepositoryCommit) editor
- .getAdapter(RepositoryCommit.class);
+ RepositoryCommit adaptedCommit = Utils.getAdapter(editor,
+ RepositoryCommit.class);
assertNotNull(adaptedCommit);
assertEquals(commit, adaptedCommit.getRevCommit());
assertEquals(repository.getDirectory(), adaptedCommit.getRepository()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
index 310547b8ee..0d6768e569 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
@@ -28,6 +28,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
@@ -84,7 +85,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
/**
* First level should have 5 children
- *
+ *
* @throws Exception
*/
@Test
@@ -98,7 +99,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
/**
* Open (expand, file->editor, branch->checkout)
- *
+ *
* @throws Exception
*/
@Test
@@ -159,7 +160,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
/**
* Checks the first level of the working directory
- *
+ *
* @throws Exception
*/
@Test
@@ -179,7 +180,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
/**
* Checks is some context menus are available, should be replaced with real
* tests
- *
+ *
* @throws Exception
*/
@Test
@@ -381,7 +382,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
IAdaptable[] elements = workingSet.getElements();
assertEquals("Wrong number of projects in working set", 1,
elements.length);
- IProject project = (IProject) elements[0].getAdapter(IProject.class);
+ IProject project = Utils.getAdapter(elements[0], IProject.class);
assertEquals("Wrong project in working set", projectName, project
.getName());
}
@@ -440,7 +441,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
/**
* Link with editor, both ways
- *
+ *
* @throws Exception
*/
@Test

Back to the top