Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-10-10 16:41:56 -0400
committerAlexander Kurtakov2019-10-10 17:10:57 -0400
commit5224c92b6770a7ecf68ec7d92476bbc23a674f01 (patch)
tree0068917b49bf763a983c141170cb76746e2bcd73 /dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples
parent46be0de323643a1ae45c6eb284127d025af4e242 (diff)
downloadorg.eclipse.cdt-5224c92b6770a7ecf68ec7d92476bbc23a674f01.tar.gz
org.eclipse.cdt-5224c92b6770a7ecf68ec7d92476bbc23a674f01.tar.xz
org.eclipse.cdt-5224c92b6770a7ecf68ec7d92476bbc23a674f01.zip
Generify Class.
Change-Id: I065b4f7c1559a141ebf2e0c82e896557a7cfc05f Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples')
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java12
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java8
2 files changed, 8 insertions, 12 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
index a5d0c705a91..849ee9ef141 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
@@ -37,8 +37,7 @@ import org.eclipse.debug.ui.contexts.ISuspendTrigger;
public class PDAAdapterFactory implements IAdapterFactory {
// This IAdapterFactory method returns adapters for the PDA launch object only.
@Override
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (!(adaptableObject instanceof PDALaunch))
return null;
@@ -58,18 +57,17 @@ public class PDAAdapterFactory implements IAdapterFactory {
// Returns the adapter type for the launch object.
if (adapterType.equals(IElementContentProvider.class))
- return adapterSet.fViewModelAdapter;
+ return adapterType.cast(adapterSet.fViewModelAdapter);
else if (adapterType.equals(IModelProxyFactory.class))
- return adapterSet.fViewModelAdapter;
+ return adapterType.cast(adapterSet.fViewModelAdapter);
else if (adapterType.equals(ISuspendTrigger.class))
- return adapterSet.fSuspendTrigger;
+ return adapterType.cast(adapterSet.fSuspendTrigger);
else
return null;
}
@Override
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { IElementContentProvider.class, IModelProxyFactory.class, ISuspendTrigger.class };
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
index 705b24a4767..c5fcd8d5fef 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
@@ -31,8 +31,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
public class PDAEditorAdapterFactory implements IAdapterFactory {
@Override
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof PDAEditor) {
ITextEditor editorPart = (ITextEditor) adaptableObject;
IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
@@ -40,7 +39,7 @@ public class PDAEditorAdapterFactory implements IAdapterFactory {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) {
if (adapterType.equals(IToggleBreakpointsTarget.class)) {
- return new PDABreakpointAdapter();
+ return adapterType.cast(new PDABreakpointAdapter());
}
}
}
@@ -49,8 +48,7 @@ public class PDAEditorAdapterFactory implements IAdapterFactory {
}
@Override
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { IToggleBreakpointsTarget.class };
}
}

Back to the top