Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2016-02-11 02:14:13 +0000
committerSergey Prigogin2016-02-11 02:15:45 +0000
commit99bae11a3c6c114b09f5098dd7bd808e912b1710 (patch)
tree5de21f3f22ebfb3fe126cff81d8f098fe8185c73 /bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java
parente5b269881ab5a1ff567ee5817e046beae2f2d2ee (diff)
downloadeclipse.platform.ui-99bae11a3c6c114b09f5098dd7bd808e912b1710.tar.gz
eclipse.platform.ui-99bae11a3c6c114b09f5098dd7bd808e912b1710.tar.xz
eclipse.platform.ui-99bae11a3c6c114b09f5098dd7bd808e912b1710.zip
Fixed few compiler warnings.
Diffstat (limited to 'bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java')
-rw-r--r--bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java
index af2f3028906..1074c534622 100644
--- a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java
+++ b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonNavigator.java
@@ -129,15 +129,8 @@ import org.eclipse.ui.part.ViewPart;
* @since 3.2
*/
public class CommonNavigator extends ViewPart implements ISetSelectionTarget, ISaveablePart, ISaveablesSource, IShowInTarget {
-
private static final String PERF_CREATE_PART_CONTROL= "org.eclipse.ui.navigator/perf/explorer/createPartControl"; //$NON-NLS-1$
-
- private static final Class INAVIGATOR_CONTENT_SERVICE = INavigatorContentService.class;
- private static final Class COMMON_VIEWER_CLASS = CommonViewer.class;
- private static final Class ISHOW_IN_SOURCE_CLASS = IShowInSource.class;
- private static final Class ISHOW_IN_TARGET_CLASS = IShowInTarget.class;
-
private static final String HELP_CONTEXT = NavigatorPlugin.PLUGIN_ID + ".common_navigator"; //$NON-NLS-1$
/**
@@ -163,7 +156,7 @@ public class CommonNavigator extends ViewPart implements ISetSelectionTarget, IS
*/
protected IMemento memento;
- private boolean isLinkingEnabled = false;
+ private boolean isLinkingEnabled;
private String LINKING_ENABLED = "CommonNavigator.LINKING_ENABLED"; //$NON-NLS-1$
@@ -235,7 +228,7 @@ public class CommonNavigator extends ViewPart implements ISetSelectionTarget, IS
commonActionGroup.fillActionBars(getViewSite().getActionBars());
ISaveablesLifecycleListener saveablesLifecycleListener = new ISaveablesLifecycleListener() {
- ISaveablesLifecycleListener siteSaveablesLifecycleListener = (ISaveablesLifecycleListener) getSite()
+ ISaveablesLifecycleListener siteSaveablesLifecycleListener = getSite()
.getService(ISaveablesLifecycleListener.class);
@Override
@@ -449,15 +442,16 @@ public class CommonNavigator extends ViewPart implements ISetSelectionTarget, IS
* have an adapter for the given class
*/
@Override
- public Object getAdapter(Class adapter) {
- if (adapter == COMMON_VIEWER_CLASS) {
- return getCommonViewer();
- } else if (adapter == INAVIGATOR_CONTENT_SERVICE) {
- return getCommonViewer().getNavigatorContentService();
- } else if (adapter == ISHOW_IN_TARGET_CLASS) {
- return this;
- } else if (adapter == ISHOW_IN_SOURCE_CLASS) {
- return getShowInSource();
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == CommonViewer.class) {
+ return (T) getCommonViewer();
+ } else if (adapter == INavigatorContentService.class) {
+ return (T) getCommonViewer().getNavigatorContentService();
+ } else if (adapter == IShowInTarget.class) {
+ return (T) this;
+ } else if (adapter == IShowInSource.class) {
+ return (T) getShowInSource();
}
return super.getAdapter(adapter);
}

Back to the top