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
* 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)) {

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
* 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<ImageDescriptor, Image> 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<Image> 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<String> initialSelection = new ArrayList<>( visibleColumns.length );
for( int i = 0; i < visibleColumns.length; 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
* 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<IRegisterDescriptor> elements = fListField.getCheckedElements();
fDescriptors = elements.toArray( new IRegisterDescriptor[elements.size()] );
}
public String getName() {

View file

@ -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)

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
* 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)

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
* 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)

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
* 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> T getAdapter( Object adaptableObject, Class<T> 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,

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
* 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> T getAdapter(Object obj, Class<T> 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;
}
}

View file

@ -62,7 +62,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>();
private boolean fIsDirty = false;
private boolean fIsCanceled = false;
private ListenerList fListeners;
private ListenerList<IPropertyChangeListener> fListeners;
private final CBreakpointContext fContext;
public CBreakpointPreferenceStore() {
@ -70,7 +70,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
}
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;
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
* 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> T getAdapter( Object adaptableObject, Class<T> 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 };
}
}

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
* 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> T getAdapter( Class<T> adapter ) {
// TODO Auto-generated method stub
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
* 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> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof ICStackFrame) {
return fDebugTextHover;
return (T) fDebugTextHover;
}
return null;
}
@Override
@SuppressWarnings("rawtypes")
public Class[] getAdapterList() {
public Class<?>[] getAdapterList() {
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
* 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> T getAdapter(Object adaptableObject, Class<T> 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 };
}
}

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
* 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<String> currentTraces = new ArrayList<String>();
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
public <T> T getAdapter(Object adaptableObject, Class<T> 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;
}
}

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
* 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<Property> 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<Property> it = fProperties.iterator();
while( it.hasNext() ) {
Property p = (Property)it.next();
Property p = it.next();
if ( p.getKey().equals( key ) ) {
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
* 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> T getAdapter(Object adaptableObject, Class<T> 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 };

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
* 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> T getAdapter(Class<T> adapter) {
if (ICStackFrame.class.equals(adapter))
return fDelegate;
return (T) fDelegate;
return fDelegate.getAdapter(adapter);
}

View file

@ -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> T getAdapter(Class<T> required) {
if (ITextViewer.class.equals(required)) {
return fSourceViewer;
return (T) fSourceViewer;
}
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
* 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<String> getDetailPaneTypes(IStructuredSelection selection) {
Set<String> possibleIDs = new HashSet<>(1);
possibleIDs.add(ModuleDetailPane.ID);
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
* 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<IContentChangeListener> 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();
}
}

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
* 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<ILaunchConfiguration> 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

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
* 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> T getAdapter(Object adaptableObject, Class<T> 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 };
}
}

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
* 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<IExtension> 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<File> 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<File> 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();
}

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
* 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<ICProject> 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() {

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
* 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();

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
* 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> T getAdapter( Class<T> adapter ) {
if ( getCSourceLocator() instanceof IAdaptable ) {
if ( adapter.equals( ICSourceLocator.class ) ) {
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );