1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix generics warnings o.e.cdt.debug.ui.

Namely:
* Adapters
* ListenerLists
* Iterators
* Collections

Change-Id: I71212da7f9ab414fb392a8388afcce762f3f4702
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2016-07-06 10:28:57 +03:00
parent 240d68cac5
commit a044217eff
26 changed files with 114 additions and 190 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2012 IBM Corporation and others. * Copyright (c) 2000, 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
@ -180,17 +180,14 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
private void runInForeground(final IStructuredSelection selection) { private void runInForeground(final IStructuredSelection selection) {
final MultiStatus status= final MultiStatus status=
new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null); new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null);
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { BusyIndicator.showWhile(Display.getCurrent(), () -> {
@Override Iterator<?> selectionIter = selection.iterator();
public void run() { while (selectionIter.hasNext()) {
Iterator selectionIter = selection.iterator(); Object element= selectionIter.next();
while (selectionIter.hasNext()) { try {
Object element= selectionIter.next(); doAction(element);
try { } catch (DebugException e) {
doAction(element); status.merge(e.getStatus());
} catch (DebugException e) {
status.merge(e.getStatus());
}
} }
} }
}); });
@ -395,7 +392,7 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
if (selection.size() == 0) { if (selection.size() == 0) {
return false; return false;
} }
Iterator itr= selection.iterator(); Iterator<?> itr= selection.iterator();
while (itr.hasNext()) { while (itr.hasNext()) {
Object element= itr.next(); Object element= itr.next();
if (!isEnabledFor(element)) { if (!isEnabledFor(element)) {

View file

@ -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
@ -67,13 +67,13 @@ public class ConfigureColumnsAction extends Action implements IUpdate {
class ColumnLabelProvider extends LabelProvider { class ColumnLabelProvider extends LabelProvider {
private Map fImages = new HashMap(); private Map<ImageDescriptor, Image> fImages = new HashMap<>();
@Override @Override
public Image getImage( Object element ) { public Image getImage( Object element ) {
ImageDescriptor imageDescriptor = fViewer.getColumnPresentation().getImageDescriptor( (String)element ); ImageDescriptor imageDescriptor = fViewer.getColumnPresentation().getImageDescriptor( (String)element );
if ( imageDescriptor != null ) { if ( imageDescriptor != null ) {
Image image = (Image)fImages.get( imageDescriptor ); Image image = fImages.get( imageDescriptor );
if ( image == null ) { if ( image == null ) {
image = imageDescriptor.createImage(); image = imageDescriptor.createImage();
fImages.put( imageDescriptor, image ); fImages.put( imageDescriptor, image );
@ -91,9 +91,9 @@ public class ConfigureColumnsAction extends Action implements IUpdate {
@Override @Override
public void dispose() { public void dispose() {
super.dispose(); super.dispose();
Iterator iterator = fImages.values().iterator(); Iterator<Image> iterator = fImages.values().iterator();
while( iterator.hasNext() ) { while( iterator.hasNext() ) {
Image image = (Image)iterator.next(); Image image = iterator.next();
image.dispose(); image.dispose();
} }
fImages.clear(); fImages.clear();
@ -124,7 +124,7 @@ public class ConfigureColumnsAction extends Action implements IUpdate {
new ColumnLabelProvider(), "Select the &columns to display:" ); new ColumnLabelProvider(), "Select the &columns to display:" );
PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.CONFIGURE_COLUMNS_DIALOG ); PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.CONFIGURE_COLUMNS_DIALOG );
String[] visibleColumns = fViewer.getVisibleColumns(); String[] visibleColumns = fViewer.getVisibleColumns();
List initialSelection = new ArrayList( visibleColumns.length ); List<String> initialSelection = new ArrayList<>( visibleColumns.length );
for( int i = 0; i < visibleColumns.length; i++ ) { for( int i = 0; i < visibleColumns.length; i++ ) {
initialSelection.add( visibleColumns[i] ); initialSelection.add( visibleColumns[i] );
} }

View file

@ -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
@ -147,15 +147,12 @@ public class RegisterGroupDialog extends TitleAreaDialog {
getButton( IDialogConstants.OK_ID ).setEnabled( name.length() > 0 ); getButton( IDialogConstants.OK_ID ).setEnabled( name.length() > 0 );
} }
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override @Override
protected void okPressed() { protected void okPressed() {
super.okPressed(); super.okPressed();
fName = fNameField.getText().trim(); fName = fNameField.getText().trim();
List elements = fListField.getCheckedElements(); List<IRegisterDescriptor> elements = fListField.getCheckedElements();
fDescriptors = (IRegisterDescriptor[])elements.toArray( new IRegisterDescriptor[elements.size()] ); fDescriptors = elements.toArray( new IRegisterDescriptor[elements.size()] );
} }
public String getName() { public String getName() {

View file

@ -197,7 +197,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
* *
* @return the type of adapter this action works on * @return the type of adapter this action works on
*/ */
protected abstract Class getAdapterClass(); protected abstract Class<?> getAdapterClass();
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart) * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2012 Freescale Semiconductor and others. * Copyright (c) 2008, 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
@ -84,11 +84,8 @@ public class RetargetMoveToLineAction extends RetargetAction {
((IMoveToLineTarget)target).canMoveToLine(part, selection, fTargetElement); ((IMoveToLineTarget)target).canMoveToLine(part, selection, fTargetElement);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass()
*/
@Override @Override
protected Class getAdapterClass() { protected Class<?> getAdapterClass() {
return IMoveToLineTarget.class; return IMoveToLineTarget.class;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -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
@ -84,11 +84,8 @@ public class RetargetResumeAtLineAction extends RetargetAction {
((IResumeAtLineTarget)target).canResumeAtLine(part, selection, fTargetElement); ((IResumeAtLineTarget)target).canResumeAtLine(part, selection, fTargetElement);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass()
*/
@Override @Override
protected Class getAdapterClass() { protected Class<?> getAdapterClass() {
return IResumeAtLineTarget.class; return IResumeAtLineTarget.class;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -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
@ -22,33 +22,26 @@ import org.eclipse.debug.ui.actions.IRunToLineTarget;
*/ */
public class RetargettableActionAdapterFactory implements IAdapterFactory { public class RetargettableActionAdapterFactory 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 ( adapterType == IRunToLineTarget.class ) { if ( adapterType == IRunToLineTarget.class ) {
return new RunToLineAdapter(); return (T) new RunToLineAdapter();
} }
if ( adapterType == IResumeAtLineTarget.class ) { if ( adapterType == IResumeAtLineTarget.class ) {
return new ResumeAtLineAdapter(); return (T) new ResumeAtLineAdapter();
} }
if ( adapterType == IMoveToLineTarget.class ) { if ( adapterType == IMoveToLineTarget.class ) {
return new MoveToLineAdapter(); return (T) new MoveToLineAdapter();
} }
if ( adapterType == IResumeWithoutSignalHandler.class ) { if ( adapterType == IResumeWithoutSignalHandler.class ) {
return new ResumeWithoutSignalCommand(); return (T) new ResumeWithoutSignalCommand();
} }
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[]{ IRunToLineTarget.class, return new Class[]{ IRunToLineTarget.class,
IResumeAtLineTarget.class, IResumeAtLineTarget.class,
IMoveToLineTarget.class, IMoveToLineTarget.class,

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2015 Wind River Systems and others. * Copyright (c) 2007, 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
@ -227,35 +227,35 @@ class CBreakpointContextAdapterFactory implements IAdapterFactory {
private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter(); private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter();
private static final IWorkbenchAdapter fgWorkbenchAdapter = new CBreakpointContextWorkbenchAdapter(); private static final IWorkbenchAdapter fgWorkbenchAdapter = new CBreakpointContextWorkbenchAdapter();
@Override @SuppressWarnings("unchecked")
public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) { @Override
public <T> T getAdapter(Object obj, Class<T> adapterType) {
// Note: only return the breakpoint object as an adapter if it has // Note: only return the breakpoint object as an adapter if it has
// an associated marker. Otherwise the property pages will throw multiple // an associated marker. Otherwise the property pages will throw multiple
// exceptions. // exceptions.
if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) && if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) &&
((CBreakpointContext)obj).getBreakpoint().getMarker() != null) ((CBreakpointContext)obj).getBreakpoint().getMarker() != null)
{ {
return ((CBreakpointContext)obj).getBreakpoint(); return (T) ((CBreakpointContext)obj).getBreakpoint();
} }
if ( IPreferenceStore.class.equals(adapterType) ) { if ( IPreferenceStore.class.equals(adapterType) ) {
return ((CBreakpointContext)obj).getPreferenceStore(); return (T) ((CBreakpointContext)obj).getPreferenceStore();
} }
if (IActionFilter.class.equals(adapterType)) { if (IActionFilter.class.equals(adapterType)) {
return fgActionFilter; return (T) fgActionFilter;
} }
if (IWorkbenchAdapter.class.equals(adapterType)) { if (IWorkbenchAdapter.class.equals(adapterType)) {
return fgWorkbenchAdapter; return (T) fgWorkbenchAdapter;
} }
return null; return null;
} }
@SuppressWarnings("rawtypes")
@Override @Override
public Class[] getAdapterList() { public Class<?>[] getAdapterList() {
return fgAdapterList; return fgAdapterList;
} }
} }

View file

@ -62,7 +62,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>(); private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>();
private boolean fIsDirty = false; private boolean fIsDirty = false;
private boolean fIsCanceled = false; private boolean fIsCanceled = false;
private ListenerList fListeners; private ListenerList<IPropertyChangeListener> fListeners;
private final CBreakpointContext fContext; private final CBreakpointContext fContext;
public CBreakpointPreferenceStore() { public CBreakpointPreferenceStore() {
@ -70,7 +70,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
} }
public CBreakpointPreferenceStore(CBreakpointContext context, Map<String, Object> attributes) { public CBreakpointPreferenceStore(CBreakpointContext context, Map<String, Object> attributes) {
fListeners = new ListenerList(org.eclipse.core.runtime.ListenerList.IDENTITY); fListeners = new ListenerList<>(org.eclipse.core.runtime.ListenerList.IDENTITY);
fContext = context; fContext = context;
fOriginalValues.clear(); fOriginalValues.clear();

View file

@ -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
@ -23,15 +23,13 @@ import org.eclipse.ui.model.WorkbenchAdapter;
*/ */
public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory { public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
/* (non-Javadoc) @SuppressWarnings("unchecked")
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override @Override
public Object getAdapter( Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType ) { public <T> T getAdapter( Object adaptableObject, Class<T> adapterType ) {
if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) { if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) {
return null; return null;
} }
return new WorkbenchAdapter() { return (T) new WorkbenchAdapter() {
@Override @Override
public String getLabel( Object o ) { public String getLabel( Object o ) {
// for now // for now
@ -46,12 +44,8 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
}; };
} }
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@SuppressWarnings("rawtypes")
@Override @Override
public Class[] getAdapterList() { public Class<?>[] getAdapterList() {
return new Class[] { IWorkbenchAdapter.class }; return new Class[] { IWorkbenchAdapter.class };
} }
} }

View file

@ -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
@ -70,12 +70,8 @@ public class DisassemblyEditorInput implements IEditorInput {
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override @Override
@SuppressWarnings("unchecked") public <T> T getAdapter( Class<T> adapter ) {
public Object getAdapter( Class adapter ) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010, 2012 Wind River Systems, Inc. and others. * Copyright (c) 2010, 2016 Wind River Systems, Inc. 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
@ -24,18 +24,17 @@ public class DebugTextHoverAdapterFactory implements IAdapterFactory {
private static final Class<?>[] TYPES = { ICEditorTextHover.class }; private static final Class<?>[] TYPES = { ICEditorTextHover.class };
private static final Object fDebugTextHover= new DebugTextHover(); private static final Object fDebugTextHover= new DebugTextHover();
@Override @SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes") @Override
public Object getAdapter(Object adaptableObject, Class adapterType) { public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof ICStackFrame) { if (adaptableObject instanceof ICStackFrame) {
return fDebugTextHover; return (T) fDebugTextHover;
} }
return null; return null;
} }
@Override @Override
@SuppressWarnings("rawtypes") public Class<?>[] getAdapterList() {
public Class[] getAdapterList() {
return TYPES; return TYPES;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2012 Freescale, Inc. * Copyright (c) 2005, 2016 Freescale, Inc.
* 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
@ -24,14 +24,11 @@ public class CMemoryAdapterFactory implements IAdapterFactory {
private static IAddMemoryBlocksTarget fgAddMemoryBlocks = new AddMemoryBlocks(); private static IAddMemoryBlocksTarget fgAddMemoryBlocks = new AddMemoryBlocks();
/* (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 (adapterType.isInstance(adaptableObject)) { if (adapterType.isInstance(adaptableObject)) {
return adaptableObject; return (T) adaptableObject;
} }
// If the backend supports memory spaces we use a custom Add Monitor // If the backend supports memory spaces we use a custom Add Monitor
@ -40,19 +37,15 @@ public class CMemoryAdapterFactory implements IAdapterFactory {
// necessary. // necessary.
if (adapterType.equals(IAddMemoryBlocksTarget.class)) { if (adapterType.equals(IAddMemoryBlocksTarget.class)) {
if (adaptableObject instanceof IMemorySpaceAwareMemoryBlockRetrieval) { if (adaptableObject instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
return fgAddMemoryBlocks; return (T) fgAddMemoryBlocks;
} }
} }
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[] { IAddMemoryBlocksTarget.class }; return new Class[] { IAddMemoryBlocksTarget.class };
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2013 Wind River Systems, Inc. and others. * Copyright (c) 2013, 2016 Wind River Systems, Inc. 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
@ -28,8 +28,7 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
private static ArrayList<String> currentTraces = new ArrayList<String>(); private static ArrayList<String> currentTraces = new ArrayList<String>();
@Override @Override
@SuppressWarnings("rawtypes") public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
public Object getAdapter(Object adaptableObject, Class adapterType) {
/* /*
* Calculate the trace to see if we already have seen this one. We only * Calculate the trace to see if we already have seen this one. We only
* want to report new instances of the violation. * want to report new instances of the violation.
@ -70,8 +69,7 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory {
* Indicates that we are adapting ILaunchable. * Indicates that we are adapting ILaunchable.
*/ */
@Override @Override
@SuppressWarnings("rawtypes") public Class<?>[] getAdapterList() {
public Class[] getAdapterList() {
return TYPES; return TYPES;
} }
} }

View file

@ -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
@ -60,7 +60,7 @@ public class ModuleProperties {
} }
} }
private ArrayList fProperties; private ArrayList<Property> fProperties;
private boolean fIsDirty = false; private boolean fIsDirty = false;
@ -72,7 +72,7 @@ public class ModuleProperties {
* Constructor for ModuleProperties. * Constructor for ModuleProperties.
*/ */
private ModuleProperties( ICModule module ) { private ModuleProperties( ICModule module ) {
fProperties = new ArrayList( 10 ); fProperties = new ArrayList<>( 10 );
fProperties.add( new Property( TYPE, Integer.valueOf(module.getType()) ) ); fProperties.add( new Property( TYPE, Integer.valueOf(module.getType()) ) );
fProperties.add( new Property( CPU, module.getCPU() ) ); fProperties.add( new Property( CPU, module.getCPU() ) );
fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) ); fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) );
@ -82,7 +82,7 @@ public class ModuleProperties {
} }
public Property[] getProperties() { public Property[] getProperties() {
return (Property[])fProperties.toArray( new Property[fProperties.size()] ); return fProperties.toArray( new Property[fProperties.size()] );
} }
public Object getProperty( String key ) { public Object getProperty( String key ) {
@ -110,9 +110,9 @@ public class ModuleProperties {
} }
private Property find( String key ) { private Property find( String key ) {
Iterator it = fProperties.iterator(); Iterator<Property> it = fProperties.iterator();
while( it.hasNext() ) { while( it.hasNext() ) {
Property p = (Property)it.next(); Property p = it.next();
if ( p.getKey().equals( key ) ) { if ( p.getKey().equals( key ) ) {
return p; return p;
} }

View file

@ -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
@ -18,20 +18,15 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
*/ */
public class SourceContainerAdapterFactory implements IAdapterFactory { public class SourceContainerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc) @SuppressWarnings("unchecked")
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override @Override
public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) { public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType.equals(IWorkbenchAdapter.class)) { if (adapterType.equals(IWorkbenchAdapter.class)) {
return new SourceContainerWorkbenchAdapter(); return (T) new SourceContainerWorkbenchAdapter();
} }
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override @Override
public Class<?>[] getAdapterList() { public Class<?>[] getAdapterList() {
return new Class[]{ IWorkbenchAdapter.class }; return new Class[]{ IWorkbenchAdapter.class };

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2015 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
@ -136,13 +136,11 @@ public class SourceDisplayAdapter implements ISourceDisplay {
return fDelegate.getModelIdentifier(); return fDelegate.getModelIdentifier();
} }
/* (non-Javadoc) @SuppressWarnings("unchecked")
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) @Override
*/ public <T> T getAdapter(Class<T> adapter) {
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (ICStackFrame.class.equals(adapter)) if (ICStackFrame.class.equals(adapter))
return fDelegate; return (T) fDelegate;
return fDelegate.getAdapter(adapter); return fDelegate.getAdapter(adapter);
} }

View file

@ -443,13 +443,11 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable,
return NAME; return NAME;
} }
/* (non-Javadoc) @SuppressWarnings("unchecked")
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) @Override
*/ public <T> T getAdapter(Class<T> required) {
@Override
public Object getAdapter(Class required) {
if (ITextViewer.class.equals(required)) { if (ITextViewer.class.equals(required)) {
return fSourceViewer; return (T) fSourceViewer;
} }
return null; return null;
} }

View file

@ -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
@ -33,12 +33,9 @@ public class ModuleDetailPaneFactory implements IDetailPaneFactory {
return new ModuleDetailPane(); return new ModuleDetailPane();
} }
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection)
*/
@Override @Override
public Set getDetailPaneTypes(IStructuredSelection selection) { public Set<String> getDetailPaneTypes(IStructuredSelection selection) {
Set possibleIDs = new HashSet(1); Set<String> possibleIDs = new HashSet<>(1);
possibleIDs.add(ModuleDetailPane.ID); possibleIDs.add(ModuleDetailPane.ID);
return possibleIDs; return possibleIDs;
} }

View file

@ -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
@ -21,50 +21,35 @@ abstract public class AbstractCDebuggerPage extends AbstractLaunchConfigurationT
implements ICDebuggerPage, ICDebuggerPageExtension { implements ICDebuggerPage, ICDebuggerPageExtension {
private String fDebuggerID = null; private String fDebuggerID = null;
private ListenerList fContentListeners; private ListenerList<IContentChangeListener> fContentListeners;
public AbstractCDebuggerPage() { public AbstractCDebuggerPage() {
super(); super();
fContentListeners = new ListenerList(); fContentListeners = new ListenerList<>();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#init(java.lang.String)
*/
@Override @Override
public void init(String debuggerID) { public void init(String debuggerID) {
fDebuggerID = debuggerID; fDebuggerID = debuggerID;
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#dispose()
*/
@Override @Override
public void dispose() { public void dispose() {
fContentListeners.clear(); fContentListeners.clear();
super.dispose(); super.dispose();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#getDebuggerIdentifier()
*/
@Override @Override
public String getDebuggerIdentifier() { public String getDebuggerIdentifier() {
return fDebuggerID; return fDebuggerID;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#addContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener)
*/
/** @since 7.0 */ /** @since 7.0 */
@Override @Override
public void addContentChangeListener(IContentChangeListener listener) { public void addContentChangeListener(IContentChangeListener listener) {
fContentListeners.add(listener); fContentListeners.add(listener);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#removeContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener)
*/
/** @since 7.0 */ /** @since 7.0 */
@Override @Override
public void removeContentChangeListener(IContentChangeListener listener) { public void removeContentChangeListener(IContentChangeListener listener) {
@ -77,7 +62,7 @@ abstract public class AbstractCDebuggerPage extends AbstractLaunchConfigurationT
* @since 7.0 * @since 7.0
*/ */
protected void contentChanged() { protected void contentChanged() {
for (Object listener : fContentListeners.getListeners()) for (IContentChangeListener listener : fContentListeners)
((IContentChangeListener) listener).contentChanged(); listener.contentChanged();
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2012 Nokia and others. * Copyright (c) 2007, 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
@ -203,7 +203,7 @@ public class ExternalToolActionComposite extends Composite {
} }
public ILaunchConfiguration[] getLaunchConfigurations() { public ILaunchConfiguration[] getLaunchConfigurations() {
ArrayList onlyExternalTools = new ArrayList(); ArrayList<ILaunchConfiguration> onlyExternalTools = new ArrayList<>();
ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager(); ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfiguration[] launchConfigurations; ILaunchConfiguration[] launchConfigurations;
try { try {
@ -226,7 +226,7 @@ public class ExternalToolActionComposite extends Composite {
} }
} catch (CoreException e) { } catch (CoreException e) {
} }
return (ILaunchConfiguration[]) onlyExternalTools.toArray(new ILaunchConfiguration[onlyExternalTools.size()]); return onlyExternalTools.toArray(new ILaunchConfiguration[onlyExternalTools.size()]);
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2012 QNX Software Systems and others. * Copyright (c) 2008, 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
@ -116,31 +116,24 @@ public class CEventBreakpointsLabelProviderFactory implements IAdapterFactory {
private static IElementLabelProvider fElementLabelProvider = new BreakpointLabelProvider(); private static IElementLabelProvider fElementLabelProvider = new BreakpointLabelProvider();
/* (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 (adapterType.equals(IElementLabelProvider.class)) { if (adapterType.equals(IElementLabelProvider.class)) {
if (adaptableObject instanceof ICEventBreakpoint) { if (adaptableObject instanceof ICEventBreakpoint) {
return fElementLabelProvider; return (T) fElementLabelProvider;
} }
} }
if (adapterType.equals(ILabelProvider.class)) { if (adapterType.equals(ILabelProvider.class)) {
if (adaptableObject instanceof ICEventBreakpoint) { if (adaptableObject instanceof ICEventBreakpoint) {
return fLabelProvider; return (T) fLabelProvider;
} }
} }
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[] { IElementLabelProvider.class, ILabelProvider.class }; return new Class[] { IElementLabelProvider.class, ILabelProvider.class };
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2012 Nokia and others. * Copyright (c) 2007, 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
@ -112,13 +112,13 @@ public class ImportExecutablePageOne extends WizardPage {
if (point != null) if (point != null)
{ {
IExtension[] exts = point.getExtensions(); IExtension[] exts = point.getExtensions();
ArrayList extensionsInUse = new ArrayList(); ArrayList<IExtension> extensionsInUse = new ArrayList<>();
for (int i = 0; i < exts.length; i++) { for (int i = 0; i < exts.length; i++) {
if (isExtensionVisible(exts[i])) { if (isExtensionVisible(exts[i])) {
extensionsInUse.add(exts[i]); extensionsInUse.add(exts[i]);
} }
} }
binaryParserExtensions = (IExtension[]) extensionsInUse.toArray(new IExtension[extensionsInUse.size()]); binaryParserExtensions = extensionsInUse.toArray(new IExtension[extensionsInUse.size()]);
} }
supportedBinaryParsers = new IBinaryParser[supportedBinaryParserIds.length]; supportedBinaryParsers = new IBinaryParser[supportedBinaryParserIds.length];
@ -147,7 +147,7 @@ public class ImportExecutablePageOne extends WizardPage {
selectMultipleTitle.setEnabled(!selectSingleFile); selectMultipleTitle.setEnabled(!selectSingleFile);
} }
private boolean collectExecutableFiles(Collection files, File directory, private boolean collectExecutableFiles(Collection<File> files, File directory,
IProgressMonitor monitor) { IProgressMonitor monitor) {
if (monitor.isCanceled()) if (monitor.isCanceled())
@ -600,10 +600,10 @@ public class ImportExecutablePageOne extends WizardPage {
executables = new File[0]; executables = new File[0];
if (directory.isDirectory()) { if (directory.isDirectory()) {
Collection files = new ArrayList(); Collection<File> files = new ArrayList<>();
if (!collectExecutableFiles(files, directory, monitor)) if (!collectExecutableFiles(files, directory, monitor))
return; return;
executables = (File[]) files.toArray(new File[files.size()]); executables = files.toArray(new File[files.size()]);
} }
monitor.done(); monitor.done();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2014 Nokia and others. * Copyright (c) 2007, 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
@ -314,7 +314,7 @@ public class ImportExecutablePageTwo extends WizardPage {
private ICProject[] getCProjects() throws CModelException { private ICProject[] getCProjects() throws CModelException {
ICProject cproject[] = CoreModel.getDefault().getCModel() ICProject cproject[] = CoreModel.getDefault().getCModel()
.getCProjects(); .getCProjects();
ArrayList list = new ArrayList(cproject.length); ArrayList<ICProject> list = new ArrayList<>(cproject.length);
for (int i = 0; i < cproject.length; i++) { for (int i = 0; i < cproject.length; i++) {
ICDescriptor cdesciptor = null; ICDescriptor cdesciptor = null;
@ -335,7 +335,7 @@ public class ImportExecutablePageTwo extends WizardPage {
list.add(cproject[i]); list.add(cproject[i]);
} }
} }
return (ICProject[]) list.toArray(new ICProject[list.size()]); return list.toArray(new ICProject[list.size()]);
} }
protected ICProject getExistingCProject() { protected ICProject getExistingCProject() {

View file

@ -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
@ -51,7 +51,7 @@ public class DefaultSourceLocator extends CSourceLookupDirector {
setLaunchConfiguration(configuration); setLaunchConfiguration(configuration);
OldDefaultSourceLocator old = new OldDefaultSourceLocator(); OldDefaultSourceLocator old = new OldDefaultSourceLocator();
old.initializeFromMemento(memento); old.initializeFromMemento(memento);
ICSourceLocator csl = (ICSourceLocator)old.getAdapter(ICSourceLocator.class); ICSourceLocator csl = old.getAdapter(ICSourceLocator.class);
setFindDuplicates(csl.searchForDuplicateFiles()); setFindDuplicates(csl.searchForDuplicateFiles());
ICSourceLocation[] locations = csl.getSourceLocations(); ICSourceLocation[] locations = csl.getSourceLocations();

View file

@ -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
@ -158,11 +158,8 @@ public class OldDefaultSourceLocator implements IPersistableSourceLocator, IAdap
initializeFromMemento( memento ); initializeFromMemento( memento );
} }
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override @Override
public Object getAdapter( Class adapter ) { public <T> T getAdapter( Class<T> adapter ) {
if ( getCSourceLocator() instanceof IAdaptable ) { if ( getCSourceLocator() instanceof IAdaptable ) {
if ( adapter.equals( ICSourceLocator.class ) ) { if ( adapter.equals( ICSourceLocator.class ) ) {
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter ); return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );