mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Move to new getAdapter() signature using generics
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
7c8b2459d5
commit
2335e8b93b
2 changed files with 9 additions and 10 deletions
|
@ -136,10 +136,10 @@ abstract public class AbstractDMContext extends PlatformObject
|
||||||
* session is equally important.
|
* session is equally important.
|
||||||
* @see org.eclipse.runtime.IAdapterManager
|
* @see org.eclipse.runtime.IAdapterManager
|
||||||
*/
|
*/
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
@SuppressWarnings("rawtypes")
|
@Override
|
||||||
public Object getAdapter(Class adapterType) {
|
public <T> T getAdapter(Class<T> adapterType) {
|
||||||
Object retVal = fSession.getModelAdapter(adapterType);
|
T retVal = (T)fSession.getModelAdapter(adapterType);
|
||||||
if (retVal == null) {
|
if (retVal == null) {
|
||||||
retVal = super.getAdapter(adapterType);
|
retVal = super.getAdapter(adapterType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2013 Ericsson and others.
|
* Copyright (c) 2013, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -26,9 +26,9 @@ import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
||||||
*/
|
*/
|
||||||
public class MemoryBlockRetrievalFactory implements IAdapterFactory {
|
public class MemoryBlockRetrievalFactory implements IAdapterFactory {
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||||
IMemoryBlockRetrieval memRetrieval = null;
|
IMemoryBlockRetrieval memRetrieval = null;
|
||||||
|
|
||||||
if (adaptableObject instanceof IDMContext) {
|
if (adaptableObject instanceof IDMContext) {
|
||||||
|
@ -44,12 +44,11 @@ public class MemoryBlockRetrievalFactory implements IAdapterFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return memRetrieval;
|
return (T)memRetrieval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
public Class[] getAdapterList() {
|
public Class<?>[] getAdapterList() {
|
||||||
return new Class[] { IMemoryBlockRetrieval.class };
|
return new Class[] { IMemoryBlockRetrieval.class };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue