Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-03-16 07:32:09 +0000
committerFred Bricon2018-03-16 14:26:12 +0000
commit488950756d0040364f3f035ad9082e7b8b5cc9f4 (patch)
treec312f5a3399dd55cb3c3b43ae7da962b85a20c64 /org.eclipse.m2e.jdt.ui
parent3577a5b0ba689c14546546902057944b0287aae1 (diff)
downloadm2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.tar.gz
m2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.tar.xz
m2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.zip
Generify getAdapter implementations.
Change-Id: Ib87da833039e5aa3d3d7ea01ab637e4100ecd4d0 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.m2e.jdt.ui')
-rw-r--r--org.eclipse.m2e.jdt.ui/src/org/eclipse/m2e/jdt/ui/internal/JavaUiElementsAdapterFactory.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/org.eclipse.m2e.jdt.ui/src/org/eclipse/m2e/jdt/ui/internal/JavaUiElementsAdapterFactory.java b/org.eclipse.m2e.jdt.ui/src/org/eclipse/m2e/jdt/ui/internal/JavaUiElementsAdapterFactory.java
index ad76ed41..5465b892 100644
--- a/org.eclipse.m2e.jdt.ui/src/org/eclipse/m2e/jdt/ui/internal/JavaUiElementsAdapterFactory.java
+++ b/org.eclipse.m2e.jdt.ui/src/org/eclipse/m2e/jdt/ui/internal/JavaUiElementsAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2018 Sonatype, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,21 +30,21 @@ import org.eclipse.m2e.core.project.IMavenProjectRegistry;
* @author Eugene Kuleshov
* @author Miles Parker
*/
-@SuppressWarnings({"restriction", "rawtypes"})
+@SuppressWarnings({"restriction"})
public class JavaUiElementsAdapterFactory implements IAdapterFactory {
- private static final Class[] ADAPTER_LIST = new Class[] {ArtifactKey.class, IMavenProjectFacade.class};
+ private static final Class<?>[] ADAPTER_LIST = new Class[] {ArtifactKey.class, IMavenProjectFacade.class};
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
}
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if(adapterType == ArtifactKey.class) {
if(adaptableObject instanceof RequiredProjectWrapper) {
IMavenProjectFacade projectFacade = getProjectFacade(adaptableObject);
if(projectFacade != null) {
- return projectFacade.getArtifactKey();
+ return adapterType.cast(projectFacade.getArtifactKey());
}
}
@@ -54,7 +54,7 @@ public class JavaUiElementsAdapterFactory implements IAdapterFactory {
IProject project = container.getJavaProject().getProject();
IMavenProjectFacade projectFacade = getProjectFacade(project);
if(projectFacade != null) {
- return projectFacade;
+ return adapterType.cast(projectFacade);
}
}
}

Back to the top