diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java index 49b09b5bf..008d024ec 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -12,10 +12,12 @@ package org.eclipse.debug.internal.ui; import org.eclipse.core.runtime.IAdapterFactory; + import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer; import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainerWorkbenchAdapter; import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointPersistableElementAdapter; + import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.IWorkbenchAdapter2; @@ -25,27 +27,28 @@ public class DebugUIAdapterFactory implements IAdapterFactory { /** * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(Object, Class) */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Object obj, Class adapterType) { + public <T> T getAdapter(Object obj, Class<T> adapterType) { if (adapterType.isInstance(obj)) { - return obj; + return (T) obj; } if (adapterType == IPersistableElement.class) { if (obj instanceof IBreakpoint) { - return new BreakpointPersistableElementAdapter((IBreakpoint)obj); + return (T) new BreakpointPersistableElementAdapter((IBreakpoint)obj); } } if (adapterType == IWorkbenchAdapter.class) { if (obj instanceof IBreakpointContainer) { - return new BreakpointContainerWorkbenchAdapter(); + return (T) new BreakpointContainerWorkbenchAdapter(); } } if (adapterType == IWorkbenchAdapter2.class) { if (obj instanceof IBreakpointContainer) { - return new BreakpointContainerWorkbenchAdapter(); + return (T) new BreakpointContainerWorkbenchAdapter(); } } @@ -56,7 +59,7 @@ public class DebugUIAdapterFactory implements IAdapterFactory { * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() */ @Override - public Class[] getAdapterList() { + public Class<?>[] getAdapterList() { return new Class[] {IPersistableElement.class, IWorkbenchAdapter.class, IWorkbenchAdapter2.class}; } |