Bug 460418 - Fix compiler problems from generified
IAdaptable#getAdapter(..)
diff --git a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/views/APIToolingView.java b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/views/APIToolingView.java
index 0a3c7bd..a0a3c86 100644
--- a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/views/APIToolingView.java
+++ b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/views/APIToolingView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 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
@@ -514,9 +514,10 @@
* (non-Javadoc) Method declared on IAdaptable
*/
@Override
- public Object getAdapter(Class adapter) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter.equals(IPropertySheetPage.class)) {
- return getPropertySheet();
+ return (T) getPropertySheet();
}
return super.getAdapter(adapter);
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
index 30a9aae..591087b 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 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
@@ -703,15 +703,16 @@
}
@Override
- public Object getAdapter(Class key) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> key) {
if (key.equals(IContentOutlinePage.class)) {
- return getContentOutline();
+ return (T) getContentOutline();
}
if (key.equals(IGotoMarker.class)) {
- return this;
+ return (T) this;
}
if (key.equals(ISearchEditorAccess.class)) {
- return this;
+ return (T) this;
}
return super.getAdapter(key);
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildEditor.java
index c7c0cf1..31e25c2 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 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
@@ -163,7 +163,7 @@
}
@Override
- public Object getAdapter(Class key) {
+ public <T> T getAdapter(Class<T> key) {
//No property sheet needed - block super
if (key.equals(IPropertySheetPage.class)) {
return null;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditor.java
index f83f5c6..4d240d2 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 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
@@ -315,7 +315,7 @@
}
@Override
- public Object getAdapter(Class key) {
+ public <T> T getAdapter(Class<T> key) {
// No property sheet needed - block super
if (key.equals(IPropertySheetPage.class)) {
return null;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditor.java
index 2f7ead1..f1dc733 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ManifestEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 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
@@ -407,7 +407,7 @@
protected void createJarEntryContexts(InputContextManager manager, JarEntryEditorInput input) {
IStorage storage = input.getStorage();
- ZipFile zip = (ZipFile) storage.getAdapter(ZipFile.class);
+ ZipFile zip = storage.getAdapter(ZipFile.class);
try {
if (zip == null)
return;
@@ -588,7 +588,7 @@
}
@Override
- public Object getAdapter(Class key) {
+ public <T> T getAdapter(Class<T> key) {
//No property sheet needed - block super
if (key.equals(IPropertySheetPage.class)) {
return null;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
index f2ee9b8..3b4ce7f 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
@@ -878,12 +878,13 @@
}
@Override
- public Object getAdapter(Class adapter) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (isShowInApplicable()) {
if (adapter == IShowInSource.class && isShowInApplicable()) {
- return getShowInSource();
+ return (T) getShowInSource();
} else if (adapter == IShowInTargetList.class) {
- return getShowInTargetList();
+ return (T) getShowInTargetList();
}
}