Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2019-06-11 09:10:40 -0400
committerMatthias Sohn2019-06-11 09:34:51 -0400
commita62e0b6023d470afc579e014868cc49c3bdd20fb (patch)
tree617f12f941ee77d800de92a3175d956b6bfbe0cf /org.eclipse.egit.ui/src/org/eclipse
parent442cd079656ec49a921d76b9b7cccb985901ed78 (diff)
downloadegit-a62e0b6023d470afc579e014868cc49c3bdd20fb.tar.gz
egit-a62e0b6023d470afc579e014868cc49c3bdd20fb.tar.xz
egit-a62e0b6023d470afc579e014868cc49c3bdd20fb.zip
Cleanup removal of adapter workaround
- remove unnecessary casts - remove unnecessary type checks since they are already done by Adapters.adapt() Change-Id: I7ce38e96a9ce21977958f27b12810732fddf24c5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java12
2 files changed, 8 insertions, 16 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
index 02034d581..d72302598 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
@@ -114,13 +114,11 @@ public class GitScopeUtil {
if (mapping != null) {
return mapping;
}
- if (o instanceof IAdaptable) {
- IContributorResourceAdapter adapted = Adapters.adapt(o,
- IContributorResourceAdapter.class);
- if (adapted instanceof IContributorResourceAdapter2) {
- IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted;
- return cra.getAdaptedResourceMapping((IAdaptable) o);
- }
+ IContributorResourceAdapter adapted = Adapters.adapt(o,
+ IContributorResourceAdapter.class);
+ if (adapted instanceof IContributorResourceAdapter2) {
+ IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted;
+ return cra.getAdaptedResourceMapping((IAdaptable) o);
}
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
index 0a08cc512..2ca03deb8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
@@ -18,7 +18,6 @@ import java.io.IOException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Adapters;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIUtils;
@@ -83,14 +82,9 @@ public class GitProjectPropertyPage extends PropertyPage {
// Get the project that is the source of this property page
IProject project = null;
- final IAdaptable element = getElement();
- if (element instanceof IResource) {
- project = ((IResource) element).getProject();
- } else {
- IResource adapter = Adapters.adapt(element, IResource.class);
- if (adapter != null) {
- project = adapter.getProject();
- }
+ IResource resource = Adapters.adapt(getElement(), IResource.class);
+ if (resource != null) {
+ project = resource.getProject();
}
RepositoryMapping mapping = RepositoryMapping.getMapping(project);

Back to the top