diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java index dbd6f1d3171..5de12faa9d7 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -180,17 +180,14 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct private void runInForeground(final IStructuredSelection selection) { final MultiStatus status= new MultiStatus(CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null); - BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { - @Override - public void run() { - Iterator selectionIter = selection.iterator(); - while (selectionIter.hasNext()) { - Object element= selectionIter.next(); - try { - doAction(element); - } catch (DebugException e) { - status.merge(e.getStatus()); - } + BusyIndicator.showWhile(Display.getCurrent(), () -> { + Iterator selectionIter = selection.iterator(); + while (selectionIter.hasNext()) { + Object element= selectionIter.next(); + try { + doAction(element); + } catch (DebugException e) { + status.merge(e.getStatus()); } } }); @@ -395,7 +392,7 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct if (selection.size() == 0) { return false; } - Iterator itr= selection.iterator(); + Iterator itr= selection.iterator(); while (itr.hasNext()) { Object element= itr.next(); if (!isEnabledFor(element)) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ConfigureColumnsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ConfigureColumnsAction.java index a004ad1404b..16e5e8199ed 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ConfigureColumnsAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ConfigureColumnsAction.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,13 +67,13 @@ public class ConfigureColumnsAction extends Action implements IUpdate { class ColumnLabelProvider extends LabelProvider { - private Map fImages = new HashMap(); + private Map fImages = new HashMap<>(); @Override public Image getImage( Object element ) { ImageDescriptor imageDescriptor = fViewer.getColumnPresentation().getImageDescriptor( (String)element ); if ( imageDescriptor != null ) { - Image image = (Image)fImages.get( imageDescriptor ); + Image image = fImages.get( imageDescriptor ); if ( image == null ) { image = imageDescriptor.createImage(); fImages.put( imageDescriptor, image ); @@ -91,9 +91,9 @@ public class ConfigureColumnsAction extends Action implements IUpdate { @Override public void dispose() { super.dispose(); - Iterator iterator = fImages.values().iterator(); + Iterator iterator = fImages.values().iterator(); while( iterator.hasNext() ) { - Image image = (Image)iterator.next(); + Image image = iterator.next(); image.dispose(); } fImages.clear(); @@ -124,7 +124,7 @@ public class ConfigureColumnsAction extends Action implements IUpdate { new ColumnLabelProvider(), "Select the &columns to display:" ); PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.CONFIGURE_COLUMNS_DIALOG ); String[] visibleColumns = fViewer.getVisibleColumns(); - List initialSelection = new ArrayList( visibleColumns.length ); + List initialSelection = new ArrayList<>( visibleColumns.length ); for( int i = 0; i < visibleColumns.length; i++ ) { initialSelection.add( visibleColumns[i] ); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RegisterGroupDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RegisterGroupDialog.java index 63076b2f831..d0b88f8773c 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RegisterGroupDialog.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RegisterGroupDialog.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * 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 ); } - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ @Override protected void okPressed() { super.okPressed(); fName = fNameField.getText().trim(); - List elements = fListField.getCheckedElements(); - fDescriptors = (IRegisterDescriptor[])elements.toArray( new IRegisterDescriptor[elements.size()] ); + List elements = fListField.getCheckedElements(); + fDescriptors = elements.toArray( new IRegisterDescriptor[elements.size()] ); } public String getName() { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java index f31f173d9b6..a2f2de5cd7d 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java @@ -197,7 +197,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate, * * @return the type of adapter this action works on */ - protected abstract Class getAdapterClass(); + protected abstract Class getAdapterClass(); /* (non-Javadoc) * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java index 14ec190a66a..43951a1d265 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -84,11 +84,8 @@ public class RetargetMoveToLineAction extends RetargetAction { ((IMoveToLineTarget)target).canMoveToLine(part, selection, fTargetElement); } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass() - */ @Override - protected Class getAdapterClass() { + protected Class getAdapterClass() { return IMoveToLineTarget.class; } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java index ee837e7baee..7667f9165a6 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -84,11 +84,8 @@ public class RetargetResumeAtLineAction extends RetargetAction { ((IResumeAtLineTarget)target).canResumeAtLine(part, selection, fTargetElement); } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass() - */ @Override - protected Class getAdapterClass() { + protected Class getAdapterClass() { return IResumeAtLineTarget.class; } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java index 11228fd8bf7..5dab6760230 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargettableActionAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,33 +22,26 @@ import org.eclipse.debug.ui.actions.IRunToLineTarget; */ public class RetargettableActionAdapterFactory implements IAdapterFactory { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - @SuppressWarnings("rawtypes") - public Object getAdapter( Object adaptableObject, Class adapterType ) { + public T getAdapter( Object adaptableObject, Class adapterType ) { if ( adapterType == IRunToLineTarget.class ) { - return new RunToLineAdapter(); + return (T) new RunToLineAdapter(); } if ( adapterType == IResumeAtLineTarget.class ) { - return new ResumeAtLineAdapter(); + return (T) new ResumeAtLineAdapter(); } if ( adapterType == IMoveToLineTarget.class ) { - return new MoveToLineAdapter(); + return (T) new MoveToLineAdapter(); } if ( adapterType == IResumeWithoutSignalHandler.class ) { - return new ResumeWithoutSignalCommand(); + return (T) new ResumeWithoutSignalCommand(); } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class, diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java index a07840f1042..1793ad9d4ef 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * 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 IWorkbenchAdapter fgWorkbenchAdapter = new CBreakpointContextWorkbenchAdapter(); - @Override - public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Object obj, Class adapterType) { // Note: only return the breakpoint object as an adapter if it has // an associated marker. Otherwise the property pages will throw multiple // exceptions. if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) && ((CBreakpointContext)obj).getBreakpoint().getMarker() != null) { - return ((CBreakpointContext)obj).getBreakpoint(); + return (T) ((CBreakpointContext)obj).getBreakpoint(); } if ( IPreferenceStore.class.equals(adapterType) ) { - return ((CBreakpointContext)obj).getPreferenceStore(); + return (T) ((CBreakpointContext)obj).getPreferenceStore(); } if (IActionFilter.class.equals(adapterType)) { - return fgActionFilter; + return (T) fgActionFilter; } if (IWorkbenchAdapter.class.equals(adapterType)) { - return fgWorkbenchAdapter; + return (T) fgWorkbenchAdapter; } return null; } - @SuppressWarnings("rawtypes") @Override - public Class[] getAdapterList() { + public Class[] getAdapterList() { return fgAdapterList; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java index 2477958b704..6e036b128a9 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java @@ -62,7 +62,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore { private HashMap fOriginalValues = new HashMap(); private boolean fIsDirty = false; private boolean fIsCanceled = false; - private ListenerList fListeners; + private ListenerList fListeners; private final CBreakpointContext fContext; public CBreakpointPreferenceStore() { @@ -70,7 +70,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore { } public CBreakpointPreferenceStore(CBreakpointContext context, Map attributes) { - fListeners = new ListenerList(org.eclipse.core.runtime.ListenerList.IDENTITY); + fListeners = new ListenerList<>(org.eclipse.core.runtime.ListenerList.IDENTITY); fContext = context; fOriginalValues.clear(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java index 23359ac5fae..13220a78103 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,15 +23,13 @@ import org.eclipse.ui.model.WorkbenchAdapter; */ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter( Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType ) { + public T getAdapter( Object adaptableObject, Class adapterType ) { if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) { return null; } - return new WorkbenchAdapter() { + return (T) new WorkbenchAdapter() { @Override public String getLabel( Object o ) { // for now @@ -46,12 +44,8 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory { }; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - @SuppressWarnings("rawtypes") @Override - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[] { IWorkbenchAdapter.class }; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorInput.java index 0a554eb78a7..4041022e086 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorInput.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorInput.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -70,12 +70,8 @@ public class DisassemblyEditorInput implements IEditorInput { return ""; //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ @Override - @SuppressWarnings("unchecked") - public Object getAdapter( Class adapter ) { + public T getAdapter( Class adapter ) { // TODO Auto-generated method stub return null; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/DebugTextHoverAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/DebugTextHoverAdapterFactory.java index b6141dde869..3343a597363 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/DebugTextHoverAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/DebugTextHoverAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * 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 Object fDebugTextHover= new DebugTextHover(); - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Object adaptableObject, Class adapterType) { if (adaptableObject instanceof ICStackFrame) { - return fDebugTextHover; + return (T) fDebugTextHover; } return null; } @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return TYPES; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CMemoryAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CMemoryAdapterFactory.java index 6a4d2b48460..eba9024ee98 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CMemoryAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CMemoryAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,14 +24,11 @@ public class CMemoryAdapterFactory implements IAdapterFactory { private static IAddMemoryBlocksTarget fgAddMemoryBlocks = new AddMemoryBlocks(); - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { if (adapterType.isInstance(adaptableObject)) { - return adaptableObject; + return (T) adaptableObject; } // If the backend supports memory spaces we use a custom Add Monitor @@ -40,19 +37,15 @@ public class CMemoryAdapterFactory implements IAdapterFactory { // necessary. if (adapterType.equals(IAddMemoryBlocksTarget.class)) { if (adaptableObject instanceof IMemorySpaceAwareMemoryBlockRetrieval) { - return fgAddMemoryBlocks; + return (T) fgAddMemoryBlocks; } } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[] { IAddMemoryBlocksTarget.class }; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java index 90bc67b6a3e..b85fc5c2fd7 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/InvalidLaunchableAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,8 +28,7 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory { private static ArrayList currentTraces = new ArrayList(); @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { /* * Calculate the trace to see if we already have seen this one. We only * want to report new instances of the violation. @@ -70,8 +69,7 @@ public class InvalidLaunchableAdapterFactory implements IAdapterFactory { * Indicates that we are adapting ILaunchable. */ @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return TYPES; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ModuleProperties.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ModuleProperties.java index eca1a8f3315..b4c5372c970 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ModuleProperties.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ModuleProperties.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,7 +60,7 @@ public class ModuleProperties { } } - private ArrayList fProperties; + private ArrayList fProperties; private boolean fIsDirty = false; @@ -72,7 +72,7 @@ public class ModuleProperties { * Constructor for ModuleProperties. */ 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( CPU, module.getCPU() ) ); fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) ); @@ -82,7 +82,7 @@ public class ModuleProperties { } public Property[] getProperties() { - return (Property[])fProperties.toArray( new Property[fProperties.size()] ); + return fProperties.toArray( new Property[fProperties.size()] ); } public Object getProperty( String key ) { @@ -110,9 +110,9 @@ public class ModuleProperties { } private Property find( String key ) { - Iterator it = fProperties.iterator(); + Iterator it = fProperties.iterator(); while( it.hasNext() ) { - Property p = (Property)it.next(); + Property p = it.next(); if ( p.getKey().equals( key ) ) { return p; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java index 19d0bcc9cbf..5fe7f5d9ddb 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,20 +18,15 @@ import org.eclipse.ui.model.IWorkbenchAdapter; */ public class SourceContainerAdapterFactory implements IAdapterFactory { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { if (adapterType.equals(IWorkbenchAdapter.class)) { - return new SourceContainerWorkbenchAdapter(); + return (T) new SourceContainerWorkbenchAdapter(); } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override public Class[] getAdapterList() { return new Class[]{ IWorkbenchAdapter.class }; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java index bc0ee51670a..31820a192b3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -136,13 +136,11 @@ public class SourceDisplayAdapter implements ISourceDisplay { return fDelegate.getModelIdentifier(); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Class adapter) { if (ICStackFrame.class.equals(adapter)) - return fDelegate; + return (T) fDelegate; return fDelegate.getAdapter(adapter); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java index c17d0023213..5a05da249ce 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java @@ -443,13 +443,11 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, return NAME; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - @Override - public Object getAdapter(Class required) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Class required) { if (ITextViewer.class.equals(required)) { - return fSourceViewer; + return (T) fSourceViewer; } return null; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java index ab2a384c0f0..4b9f6b6c839 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,12 +33,9 @@ public class ModuleDetailPaneFactory implements IDetailPaneFactory { return new ModuleDetailPane(); } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection) - */ @Override - public Set getDetailPaneTypes(IStructuredSelection selection) { - Set possibleIDs = new HashSet(1); + public Set getDetailPaneTypes(IStructuredSelection selection) { + Set possibleIDs = new HashSet<>(1); possibleIDs.add(ModuleDetailPane.ID); return possibleIDs; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/AbstractCDebuggerPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/AbstractCDebuggerPage.java index ee88181f0f3..68a1ec3d07c 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/AbstractCDebuggerPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/AbstractCDebuggerPage.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,50 +21,35 @@ abstract public class AbstractCDebuggerPage extends AbstractLaunchConfigurationT implements ICDebuggerPage, ICDebuggerPageExtension { private String fDebuggerID = null; - private ListenerList fContentListeners; + private ListenerList fContentListeners; public AbstractCDebuggerPage() { super(); - fContentListeners = new ListenerList(); + fContentListeners = new ListenerList<>(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.ICDebuggerPage#init(java.lang.String) - */ @Override public void init(String debuggerID) { fDebuggerID = debuggerID; } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#dispose() - */ @Override public void dispose() { fContentListeners.clear(); super.dispose(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.ICDebuggerPage#getDebuggerIdentifier() - */ @Override public String getDebuggerIdentifier() { return fDebuggerID; } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#addContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener) - */ /** @since 7.0 */ @Override public void addContentChangeListener(IContentChangeListener listener) { fContentListeners.add(listener); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#removeContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener) - */ /** @since 7.0 */ @Override public void removeContentChangeListener(IContentChangeListener listener) { @@ -77,7 +62,7 @@ abstract public class AbstractCDebuggerPage extends AbstractLaunchConfigurationT * @since 7.0 */ protected void contentChanged() { - for (Object listener : fContentListeners.getListeners()) - ((IContentChangeListener) listener).contentChanged(); + for (IContentChangeListener listener : fContentListeners) + listener.contentChanged(); } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolActionComposite.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolActionComposite.java index 4a462d2f090..bd66ed9637b 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolActionComposite.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolActionComposite.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -203,7 +203,7 @@ public class ExternalToolActionComposite extends Composite { } public ILaunchConfiguration[] getLaunchConfigurations() { - ArrayList onlyExternalTools = new ArrayList(); + ArrayList onlyExternalTools = new ArrayList<>(); ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfiguration[] launchConfigurations; try { @@ -226,7 +226,7 @@ public class ExternalToolActionComposite extends Composite { } } catch (CoreException e) { } - return (ILaunchConfiguration[]) onlyExternalTools.toArray(new ILaunchConfiguration[onlyExternalTools.size()]); + return onlyExternalTools.toArray(new ILaunchConfiguration[onlyExternalTools.size()]); } @Override diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java index 1a10c8483b5..df718ff3145 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java @@ -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 * 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(); - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { if (adapterType.equals(IElementLabelProvider.class)) { if (adaptableObject instanceof ICEventBreakpoint) { - return fElementLabelProvider; + return (T) fElementLabelProvider; } } if (adapterType.equals(ILabelProvider.class)) { if (adaptableObject instanceof ICEventBreakpoint) { - return fLabelProvider; + return (T) fLabelProvider; } } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[] { IElementLabelProvider.class, ILabelProvider.class }; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java index 66efa810151..0c848b98a9c 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -112,13 +112,13 @@ public class ImportExecutablePageOne extends WizardPage { if (point != null) { IExtension[] exts = point.getExtensions(); - ArrayList extensionsInUse = new ArrayList(); + ArrayList extensionsInUse = new ArrayList<>(); for (int i = 0; i < exts.length; i++) { if (isExtensionVisible(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]; @@ -147,7 +147,7 @@ public class ImportExecutablePageOne extends WizardPage { selectMultipleTitle.setEnabled(!selectSingleFile); } - private boolean collectExecutableFiles(Collection files, File directory, + private boolean collectExecutableFiles(Collection files, File directory, IProgressMonitor monitor) { if (monitor.isCanceled()) @@ -600,10 +600,10 @@ public class ImportExecutablePageOne extends WizardPage { executables = new File[0]; if (directory.isDirectory()) { - Collection files = new ArrayList(); + Collection files = new ArrayList<>(); if (!collectExecutableFiles(files, directory, monitor)) return; - executables = (File[]) files.toArray(new File[files.size()]); + executables = files.toArray(new File[files.size()]); } monitor.done(); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageTwo.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageTwo.java index dc3c668a436..74c286d0447 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageTwo.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageTwo.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -314,7 +314,7 @@ public class ImportExecutablePageTwo extends WizardPage { private ICProject[] getCProjects() throws CModelException { ICProject cproject[] = CoreModel.getDefault().getCModel() .getCProjects(); - ArrayList list = new ArrayList(cproject.length); + ArrayList list = new ArrayList<>(cproject.length); for (int i = 0; i < cproject.length; i++) { ICDescriptor cdesciptor = null; @@ -335,7 +335,7 @@ public class ImportExecutablePageTwo extends WizardPage { list.add(cproject[i]); } } - return (ICProject[]) list.toArray(new ICProject[list.size()]); + return list.toArray(new ICProject[list.size()]); } protected ICProject getExistingCProject() { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java index 0ed000ad52f..dc46becec6f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,7 +51,7 @@ public class DefaultSourceLocator extends CSourceLookupDirector { setLaunchConfiguration(configuration); OldDefaultSourceLocator old = new OldDefaultSourceLocator(); old.initializeFromMemento(memento); - ICSourceLocator csl = (ICSourceLocator)old.getAdapter(ICSourceLocator.class); + ICSourceLocator csl = old.getAdapter(ICSourceLocator.class); setFindDuplicates(csl.searchForDuplicateFiles()); ICSourceLocation[] locations = csl.getSourceLocations(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/OldDefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/OldDefaultSourceLocator.java index 3c1adf68dc3..c503383c065 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/OldDefaultSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/OldDefaultSourceLocator.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -158,11 +158,8 @@ public class OldDefaultSourceLocator implements IPersistableSourceLocator, IAdap initializeFromMemento( memento ); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ @Override - public Object getAdapter( Class adapter ) { + public T getAdapter( Class adapter ) { if ( getCSourceLocator() instanceof IAdaptable ) { if ( adapter.equals( ICSourceLocator.class ) ) { return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );