mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Generify o.e.cdt.debug.core.
Fix warnings about adapters and listener lists not being generified. Change-Id: If5e54e6df452884947f32a31ef9c0c53677b88c8 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
9b4dba0458
commit
240d68cac5
8 changed files with 50 additions and 81 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 IBM Corporation and others.
|
* Copyright (c) 2006, 2016 IBM Corporation 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,24 +26,19 @@ import org.eclipse.debug.core.commands.IRestartHandler;
|
||||||
public class CCommandAdapterFactory implements IAdapterFactory {
|
public class CCommandAdapterFactory implements IAdapterFactory {
|
||||||
private static IRestartHandler fgRestartCommand = new RestartCommand();
|
private static IRestartHandler fgRestartCommand = new RestartCommand();
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@SuppressWarnings("unchecked")
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||||
if (IRestartHandler.class.equals(adapterType)) {
|
if (IRestartHandler.class.equals(adapterType)) {
|
||||||
if (adaptableObject instanceof IRestart) {
|
if (adaptableObject instanceof IRestart) {
|
||||||
return fgRestartCommand;
|
return (T) fgRestartCommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Class[] getAdapterList() {
|
public Class<?>[] getAdapterList() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
IRestartHandler.class
|
IRestartHandler.class
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2011 Nokia and others.
|
* Copyright (c) 2008, 2016 Nokia 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
|
||||||
|
@ -156,14 +156,14 @@ public class Executable extends PlatformObject {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (adapter.equals(IResource.class))
|
if (adapter.equals(IResource.class))
|
||||||
if (getResource() != null)
|
if (getResource() != null)
|
||||||
return getResource();
|
return (T) getResource();
|
||||||
else
|
else
|
||||||
return this.getProject();
|
return (T) this.getProject();
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 Wind River Systems and others.
|
* Copyright (c) 2012, 2016 Wind River Systems 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
|
||||||
|
@ -19,10 +19,9 @@ import org.eclipse.debug.core.model.IDebugModelProvider;
|
||||||
* Debug model provider returns additional model ID to use with
|
* Debug model provider returns additional model ID to use with
|
||||||
* GDB event breakpoints.
|
* GDB event breakpoints.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory {
|
public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory {
|
||||||
|
|
||||||
private final static Class[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class };
|
private final static Class<?>[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class };
|
||||||
private final static String GDB_MODEL_ID = "org.eclipse.cdt.gdb"; //$NON-NLS-1$
|
private final static String GDB_MODEL_ID = "org.eclipse.cdt.gdb"; //$NON-NLS-1$
|
||||||
private final static String[] MODEL_IDS = new String[] { CDIDebugModel.getPluginIdentifier(), GDB_MODEL_ID };
|
private final static String[] MODEL_IDS = new String[] { CDIDebugModel.getPluginIdentifier(), GDB_MODEL_ID };
|
||||||
|
|
||||||
|
@ -31,16 +30,17 @@ public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory
|
||||||
return MODEL_IDS;
|
return MODEL_IDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("unchecked")
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
@Override
|
||||||
|
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||||
if ( adaptableObject instanceof ICDebugElement && IDebugModelProvider.class.equals(adapterType) ) {
|
if ( adaptableObject instanceof ICDebugElement && IDebugModelProvider.class.equals(adapterType) ) {
|
||||||
return this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class[] getAdapterList() {
|
public Class<?>[] getAdapterList() {
|
||||||
return ADAPTER_LIST;
|
return ADAPTER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2012 ARM Limited and others.
|
* Copyright (c) 2008, 2016 ARM Limited 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
|
||||||
|
@ -20,56 +20,44 @@ import org.eclipse.core.runtime.ListenerList;
|
||||||
|
|
||||||
public class DisassemblyContextService implements IDisassemblyContextService {
|
public class DisassemblyContextService implements IDisassemblyContextService {
|
||||||
|
|
||||||
private ListenerList fListeners;
|
private ListenerList<IDisassemblyContextListener> fListeners;
|
||||||
private Set<Object> fContexts;
|
private Set<Object> fContexts;
|
||||||
|
|
||||||
public DisassemblyContextService() {
|
public DisassemblyContextService() {
|
||||||
fContexts = new CopyOnWriteArraySet<Object>();
|
fContexts = new CopyOnWriteArraySet<Object>();
|
||||||
fListeners = new ListenerList();
|
fListeners = new ListenerList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#addDisassemblyContextListener(org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addDisassemblyContextListener( IDisassemblyContextListener listener ) {
|
public void addDisassemblyContextListener( IDisassemblyContextListener listener ) {
|
||||||
fListeners.add( listener );
|
fListeners.add( listener );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#removeDisassemblyContextListener(org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeDisassemblyContextListener( IDisassemblyContextListener listener ) {
|
public void removeDisassemblyContextListener( IDisassemblyContextListener listener ) {
|
||||||
fListeners.remove( listener );
|
fListeners.remove( listener );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#register(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void register( Object context ) {
|
public void register( Object context ) {
|
||||||
fContexts.add( context );
|
fContexts.add( context );
|
||||||
for( Object listener : fListeners.getListeners() ) {
|
for( IDisassemblyContextListener listener : fListeners) {
|
||||||
((IDisassemblyContextListener)listener).contextAdded( context );
|
listener.contextAdded( context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#unregister(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void unregister( Object context ) {
|
public void unregister( Object context ) {
|
||||||
fContexts.remove( context );
|
fContexts.remove( context );
|
||||||
for( Object listener : fListeners.getListeners() ) {
|
for( IDisassemblyContextListener listener : fListeners) {
|
||||||
((IDisassemblyContextListener)listener).contextRemoved( context );
|
listener.contextRemoved( context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
for( Object context : fContexts ) {
|
for( Object context : fContexts ) {
|
||||||
for( Object listener : fListeners.getListeners() ) {
|
for( IDisassemblyContextListener listener : fListeners) {
|
||||||
((IDisassemblyContextListener)listener).contextRemoved( context );
|
listener.contextRemoved( context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fListeners.clear();
|
fListeners.clear();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
* Copyright (c) 2000, 2016 QNX Software Systems 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
|
||||||
|
@ -107,17 +107,15 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@SuppressWarnings("unchecked")
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (adapter.equals(ICSourceLocation.class))
|
if (adapter.equals(ICSourceLocation.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(CDirectorySourceLocation.class))
|
if (adapter.equals(CDirectorySourceLocation.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(IPath.class))
|
if (adapter.equals(IPath.class))
|
||||||
return getDirectory();
|
return (T) getDirectory();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
* Copyright (c) 2000, 2016 QNX Software Systems 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
|
||||||
|
@ -98,17 +98,15 @@ public class CProjectSourceLocation implements IProjectSourceLocation {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@SuppressWarnings("unchecked")
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (adapter.equals(ICSourceLocation.class))
|
if (adapter.equals(ICSourceLocation.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(CProjectSourceLocation.class))
|
if (adapter.equals(CProjectSourceLocation.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(IProject.class))
|
if (adapter.equals(IProject.class))
|
||||||
return getProject();
|
return (T) getProject();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2012 QNX Software Systems and others.
|
* Copyright (c) 2004, 2016 QNX Software Systems 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
|
||||||
|
@ -83,20 +83,17 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato
|
||||||
return (getCSourceLocator() != null) ? getCSourceLocator().contains(resource) : false;
|
return (getCSourceLocator() != null) ? getCSourceLocator().contains(resource) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@SuppressWarnings("unchecked")
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (adapter.equals(CSourceManager.class))
|
if (adapter.equals(CSourceManager.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(ICSourceLocator.class))
|
if (adapter.equals(ICSourceLocator.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(IPersistableSourceLocator.class))
|
if (adapter.equals(IPersistableSourceLocator.class))
|
||||||
return this;
|
return (T) this;
|
||||||
if (adapter.equals(IResourceChangeListener.class) && fSourceLocator instanceof IResourceChangeListener)
|
if (adapter.equals(IResourceChangeListener.class) && fSourceLocator instanceof IResourceChangeListener)
|
||||||
return fSourceLocator;
|
return (T) fSourceLocator;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2012 Freescale Semiconductor and others.
|
* Copyright (c) 2010, 2016 Freescale Semiconductor 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
|
||||||
|
@ -19,26 +19,19 @@ import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
*/
|
*/
|
||||||
public class CSourceFinderFactory implements IAdapterFactory {
|
public class CSourceFinderFactory implements IAdapterFactory {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@SuppressWarnings("unchecked")
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("rawtypes")
|
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
|
||||||
if (adaptableObject instanceof IBinary) {
|
if (adaptableObject instanceof IBinary) {
|
||||||
if (adapterType.equals(ISourceFinder.class)) {
|
if (adapterType.equals(ISourceFinder.class)) {
|
||||||
return new CSourceFinder((IBinary)adaptableObject);
|
return (T) new CSourceFinder((IBinary)adaptableObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("rawtypes")
|
public Class<?>[] getAdapterList() {
|
||||||
public Class[] getAdapterList() {
|
|
||||||
return new Class[] { ISourceFinder.class };
|
return new Class[] { ISourceFinder.class };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue