Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractSelectionActionDelegate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SkipAllBreakpointsAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/SuspendTriggerAdapterFactory.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementAdapterFactory.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java99
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java2
84 files changed, 400 insertions, 312 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
index 37419aadb..6c950b2f0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -43,10 +43,10 @@ public class DebugModelPropertyTester extends PropertyTester {
if (MODEL_TYPE_PROPERTY.equals(property)){
IDebugTarget target = null;
if(receiver instanceof IProcess) {
- target = (IDebugTarget) ((IProcess)receiver).getAdapter(IDebugTarget.class);
+ target = ((IProcess)receiver).getAdapter(IDebugTarget.class);
}
else if(receiver instanceof IDebugElement) {
- target = (IDebugTarget) ((IDebugElement)receiver).getAdapter(IDebugTarget.class);
+ target = ((IDebugElement)receiver).getAdapter(IDebugTarget.class);
}
if(target != null) {
// check that the expected value argument is valid
@@ -60,10 +60,10 @@ public class DebugModelPropertyTester extends PropertyTester {
}
IDebugModelProvider modelProvider = null;
if (receiver instanceof IAdaptable) {
- modelProvider = (IDebugModelProvider) ((IAdaptable)receiver).getAdapter(IDebugModelProvider.class);
+ modelProvider = ((IAdaptable)receiver).getAdapter(IDebugModelProvider.class);
} else {
modelProvider =
- (IDebugModelProvider) Platform.getAdapterManager().
+ Platform.getAdapterManager().
getAdapter(receiver, IDebugModelProvider.class);
}
if (modelProvider != null) {
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};
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
index b0c876923..198430846 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.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
@@ -73,7 +73,7 @@ public class DefaultLabelProvider implements ILabelProvider {
return null;
}
if (key == null && element instanceof IAdaptable) {
- IWorkbenchAdapter de= (IWorkbenchAdapter) ((IAdaptable) element).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter de= ((IAdaptable) element).getAdapter(IWorkbenchAdapter.class);
if (de != null) {
ImageDescriptor descriptor= de.getImageDescriptor(element);
if( descriptor != null) {
@@ -298,7 +298,7 @@ public class DefaultLabelProvider implements ILabelProvider {
public String getAdapterLabel(Object object) {
if (object instanceof IAdaptable) {
- IWorkbenchAdapter de= (IWorkbenchAdapter) ((IAdaptable) object).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter de= ((IAdaptable) object).getAdapter(IWorkbenchAdapter.class);
if (de != null) {
return de.getLabel(object);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
index 1b8b97e1e..aec606b2e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 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
@@ -48,10 +48,10 @@ public class ResourceExtender extends PropertyTester {
*/
@Override
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- IResource resource = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class);
+ IResource resource = ((IAdaptable) receiver).getAdapter(IResource.class);
if (resource == null) {
if (PROPERTY_MATCHES_CONTENT_TYPE.equals(method)) {
- IPathEditorInput editorInput = (IPathEditorInput) ((IAdaptable) receiver).getAdapter(IPathEditorInput.class);
+ IPathEditorInput editorInput = ((IAdaptable) receiver).getAdapter(IPathEditorInput.class);
if (editorInput != null) {
IPath path= editorInput.getPath();
File file= path.toFile();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractSelectionActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractSelectionActionDelegate.java
index ebe3fbc8c..6d2078c39 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractSelectionActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractSelectionActionDelegate.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
@@ -120,7 +120,7 @@ public abstract class AbstractSelectionActionDelegate implements IViewActionDele
@Override
public void init(IViewPart view) {
setView(view);
- fProgressService = (IWorkbenchSiteProgressService) view.getAdapter(IWorkbenchSiteProgressService.class);
+ fProgressService = view.getAdapter(IWorkbenchSiteProgressService.class);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
index 8de05528a..aaa58be3c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.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
@@ -65,7 +65,7 @@ public class AddToFavoritesAction extends SelectionListenerAction {
Object object = selection.getFirstElement();
ILaunch launch = null;
if (object instanceof IAdaptable) {
- launch = (ILaunch)((IAdaptable)object).getAdapter(ILaunch.class);
+ launch = ((IAdaptable)object).getAdapter(ILaunch.class);
}
if (launch == null) {
if (object instanceof ILaunch) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java
index 0bfbb4b55..9131390b5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.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
@@ -61,7 +61,7 @@ public class EditLaunchConfigurationAction extends SelectionListenerAction {
Object object = selection.getFirstElement();
ILaunch launch = null;
if (object instanceof IAdaptable) {
- launch = (ILaunch)((IAdaptable)object).getAdapter(ILaunch.class);
+ launch = ((IAdaptable)object).getAdapter(ILaunch.class);
}
if (launch == null) {
if (object instanceof ILaunch) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
index 02c03f87f..842403363 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -64,7 +64,7 @@ public class LaunchablePropertyTester extends PropertyTester {
if (element instanceof IResource) {
resource = (IResource) element;
} else if (element instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
+ resource = ((IAdaptable)element).getAdapter(IResource.class);
}
return resource;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java
index fc047374d..a66d4f5a0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.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
@@ -161,9 +161,9 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
@Override
public void partActivated(IWorkbenchPart part) {
fActivePart = part;
- IResource resource = (IResource) part.getAdapter(IResource.class);
+ IResource resource = part.getAdapter(IResource.class);
if (resource == null && part instanceof IEditorPart) {
- resource = (IResource) ((IEditorPart)part).getEditorInput().getAdapter(IResource.class);
+ resource = ((IEditorPart)part).getEditorInput().getAdapter(IResource.class);
}
if (resource != null) {
fTargetAdapter = getAdapter(resource);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java
index 1baa069a2..a920aa945 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.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
@@ -32,7 +32,7 @@ public abstract class SelectAllAction extends AbstractRemoveAllActionDelegate {
@Override
public void init(IViewPart view) {
fView = view;
- IDebugView debugView = (IDebugView) getView().getAdapter(IDebugView.class);
+ IDebugView debugView = getView().getAdapter(IDebugView.class);
if (debugView != null) {
debugView.setAction(getActionId(), getAction());
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
index 19789ebd7..1d3f5ddc5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 IBM Corporation and others.
+ * Copyright (c) 2008, 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,8 +315,7 @@ public class ToggleBreakpointsTargetManager implements IToggleBreakpointsTargetM
if (adaptable != null) {
IToggleBreakpointsTarget adapter = null;
if (adaptable instanceof IAdaptable) {
- adapter = (IToggleBreakpointsTarget)
- ((IAdaptable)adaptable).getAdapter(IToggleBreakpointsTarget.class);
+ adapter = ((IAdaptable)adaptable).getAdapter(IToggleBreakpointsTarget.class);
}
if (adapter == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
index 29697f14c..407beb12a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.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
@@ -198,7 +198,7 @@ public class ShowSupportedBreakpointsAction extends ToggleFilterAction implement
debugTargets.add(targets[j]);
}
} else if (next instanceof IProcess) {
- IDebugTarget target= (IDebugTarget)((IProcess)next).getAdapter(IDebugTarget.class);
+ IDebugTarget target= ((IProcess)next).getAdapter(IDebugTarget.class);
if (target != null) {
debugTargets.add(target);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SkipAllBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SkipAllBreakpointsAction.java
index da603a1b4..a5de1715f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SkipAllBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SkipAllBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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
@@ -82,7 +82,7 @@ public class SkipAllBreakpointsAction extends Action implements IWorkbenchWindow
public void run(){
IWorkbenchSiteProgressService progressService = null;
if (fPart != null) {
- progressService = (IWorkbenchSiteProgressService)fPart.getSite().
+ progressService = fPart.getSite().
getAdapter(IWorkbenchSiteProgressService.class);
}
final boolean enabled = !getBreakpointManager().isEnabled();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java
index 9e2edc535..17f06b692 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.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
@@ -101,7 +101,7 @@ public class EnableWatchExpressionAction implements IViewActionDelegate, IAction
if (element instanceof IWatchExpression) {
return (IWatchExpression)element;
} else if (element instanceof IAdaptable) {
- return (IWatchExpression)((IAdaptable)element).getAdapter(IWatchExpression.class);
+ return ((IAdaptable)element).getAdapter(IWatchExpression.class);
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java
index a2a00d0ca..2ca6e9ebe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.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
@@ -40,7 +40,7 @@ public class RemoveExpressionAction extends AbstractSelectionActionDelegate {
if (segment instanceof IExpression) {
expressions.add((IExpression) segment);
} else if (segment instanceof IAdaptable) {
- IExpression expression = (IExpression)((IAdaptable)segment).getAdapter(IExpression.class);
+ IExpression expression = ((IAdaptable)segment).getAdapter(IExpression.class);
if (expression != null) {
expressions.add(expression);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java
index 55972bc6f..237fd5aef 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.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
@@ -72,7 +72,7 @@ public abstract class WatchExpressionAction implements IViewActionDelegate {
if (element instanceof IWatchExpression) {
list.add(element);
} else if (element instanceof IAdaptable) {
- IWatchExpression expr = (IWatchExpression)((IAdaptable)element).getAdapter(IWatchExpression.class);
+ IWatchExpression expr = ((IAdaptable)element).getAdapter(IWatchExpression.class);
if (expr != null) {
list.add(expr);
} else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
index b2d8fd139..c06864c84 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Wind River Systems and others.
+ * Copyright (c) 2008, 2015 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
@@ -119,7 +119,7 @@ public class WatchHandler extends AbstractHandler {
* @return factory or <code>null</code>
*/
static IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
- return (IWatchExpressionFactoryAdapter) variable.getAdapter(IWatchExpressionFactoryAdapter.class);
+ return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
}
/**
@@ -130,7 +130,7 @@ public class WatchHandler extends AbstractHandler {
*/
static IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
if (element instanceof IAdaptable) {
- return (IWatchExpressionFactoryAdapter2)((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
+ return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
index 681bd7a08..23bcdded0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ShowTypesAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
@@ -62,7 +62,7 @@ public class ShowTypesAction extends Action {
return;
}
- IDebugModelPresentation debugLabelProvider= (IDebugModelPresentation)getView().getAdapter(IDebugModelPresentation.class);
+ IDebugModelPresentation debugLabelProvider= getView().getAdapter(IDebugModelPresentation.class);
if (debugLabelProvider != null) {
Boolean typesStatus = on ? Boolean.TRUE : Boolean.FALSE;
debugLabelProvider.setAttribute(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES, typesStatus);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
index 35052121c..f417fa4b0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -112,7 +112,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
// singleton manager
private static DebugModelContextBindingManager fgManager;
- private static IContextService fgContextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
+ private static IContextService fgContextService = PlatformUI.getWorkbench().getAdapter(IContextService.class);
public static DebugModelContextBindingManager getDefault() {
if (fgManager == null) {
@@ -300,7 +300,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private String[] getDebugModelIds(Object object) {
if (object instanceof IAdaptable) {
- IDebugModelProvider modelProvider= (IDebugModelProvider)((IAdaptable)object).getAdapter(IDebugModelProvider.class);
+ IDebugModelProvider modelProvider= ((IAdaptable)object).getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] modelIds= modelProvider.getModelIdentifiers();
if (modelIds != null) {
@@ -324,7 +324,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
public static ILaunch getLaunch(Object object) {
ILaunch launch = null;
if (object instanceof IAdaptable) {
- launch = (ILaunch) ((IAdaptable)object).getAdapter(ILaunch.class);
+ launch = ((IAdaptable)object).getAdapter(ILaunch.class);
}
if (launch == null && object instanceof IDebugElement) {
launch = ((IDebugElement) object).getLaunch();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
index 4302aed21..3621dbe9d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -88,7 +88,7 @@ public class LaunchSuspendTrigger implements ISuspendTrigger, IDebugEventSetList
Object source = event.getSource();
if (source instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) source;
- ILaunch launch = (ILaunch) adaptable.getAdapter(ILaunch.class);
+ ILaunch launch = adaptable.getAdapter(ILaunch.class);
if (fLaunch.equals(launch)) {
// only notify for this launch
notifySuspend(event);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/SuspendTriggerAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/SuspendTriggerAdapterFactory.java
index d542267b9..22440d2e7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/SuspendTriggerAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/SuspendTriggerAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -14,7 +14,9 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IAdapterFactory;
+
import org.eclipse.debug.core.ILaunch;
+
import org.eclipse.debug.ui.contexts.ISuspendTrigger;
/**
@@ -27,8 +29,9 @@ public class SuspendTriggerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public synchronized Object getAdapter(Object adaptableObject, Class adapterType) {
+ public synchronized <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType.equals(ISuspendTrigger.class)) {
if (adaptableObject instanceof ILaunch) {
LaunchSuspendTrigger trigger = fSuspendTriggers.get(adaptableObject);
@@ -36,7 +39,7 @@ public class SuspendTriggerAdapterFactory implements IAdapterFactory {
trigger = new LaunchSuspendTrigger((ILaunch) adaptableObject, this);
fSuspendTriggers.put(adaptableObject, trigger);
}
- return trigger;
+ return (T) trigger;
}
}
return null;
@@ -46,7 +49,7 @@ public class SuspendTriggerAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[]{ISuspendTrigger.class};
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index ffa412b99..d2a8c279a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -112,7 +112,7 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
AbstractAsyncTableRendering rendering = getTableRendering(context);
if (rendering != null) {
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor) rendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = rendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor == null) {
return new Object[0];
@@ -232,7 +232,7 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
throw e;
}
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor) tableRendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = tableRendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor == null) {
return new Object[0];
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
index 9324f12f6..eca235333 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -52,7 +52,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (tableRenderingContext.getRendering() != null && tableRenderingContext.getRendering() instanceof AbstractAsyncTableRendering)
{
AbstractAsyncTableRendering tableRendering = (AbstractAsyncTableRendering)tableRenderingContext.getRendering();
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor)tableRendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = tableRendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor != null)
{
String addressStr = getColumnText(element, 0, tableRendering, descriptor);
@@ -63,7 +63,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
for (int i=0; i<=numColumns; i++)
{
- labels[i+1] = getColumnText(element, i+1, tableRendering, (TableRenderingContentDescriptor)tableRendering.getAdapter(TableRenderingContentDescriptor.class));
+ labels[i+1] = getColumnText(element, i+1, tableRendering, tableRendering.getAdapter(TableRenderingContentDescriptor.class));
}
labels[labels.length - 1 ] = IInternalDebugCoreConstants.EMPTY_STRING;
@@ -79,7 +79,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (columnIndex == 0)
{
- IMemoryBlockTablePresentation presentation = (IMemoryBlockTablePresentation)tableRendering.getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
+ IMemoryBlockTablePresentation presentation = tableRendering.getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
if (presentation != null)
{
String rowLabel = presentation.getRowLabel(tableRendering.getMemoryBlock(), ((MemorySegment)element).getAddress());
@@ -116,7 +116,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
return IInternalDebugCoreConstants.EMPTY_STRING;
}
- ILabelProvider labelProvider = (ILabelProvider)tableRendering.getAdapter(ILabelProvider.class);
+ ILabelProvider labelProvider = tableRendering.getAdapter(ILabelProvider.class);
if (labelProvider != null && columnIndex > 0)
{
MemoryRenderingElement renderingElement = getMemoryRenderingElement(element, columnIndex, tableRendering);
@@ -173,7 +173,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (segment.getBytes().length != tableRendering.getBytesPerLine())
return null;
- ILabelProvider labelProvider = (ILabelProvider)tableRendering.getAdapter(ILabelProvider.class);
+ ILabelProvider labelProvider = tableRendering.getAdapter(ILabelProvider.class);
if (labelProvider != null && columnIndex > 0)
{
MemoryRenderingElement renderingElement = getMemoryRenderingElement(element, columnIndex, tableRendering);
@@ -243,7 +243,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (segment.getBytes().length != tableRendering.getBytesPerLine())
return null;
- IFontProvider fontProvider = (IFontProvider)tableRendering.getAdapter(IFontProvider.class);
+ IFontProvider fontProvider = tableRendering.getAdapter(IFontProvider.class);
if (fontProvider != null && columnIndex > 0)
{
MemoryRenderingElement renderingElement = getMemoryRenderingElement(element, columnIndex, tableRendering);
@@ -296,7 +296,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (segment.getBytes().length != tableRendering.getBytesPerLine())
return null;
- IColorProvider colorProvider = (IColorProvider)tableRendering.getAdapter(IColorProvider.class);
+ IColorProvider colorProvider = tableRendering.getAdapter(IColorProvider.class);
if (colorProvider != null && columnIndex > 0)
{
MemoryRenderingElement renderingElement = getMemoryRenderingElement(element, columnIndex, tableRendering);
@@ -321,7 +321,7 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
if (segment.getBytes().length != tableRendering.getBytesPerLine())
return null;
- IColorProvider colorProvider = (IColorProvider)tableRendering.getAdapter(IColorProvider.class);
+ IColorProvider colorProvider = tableRendering.getAdapter(IColorProvider.class);
if (colorProvider != null && columnIndex > 0)
{
MemoryRenderingElement renderingElement = getMemoryRenderingElement(element, columnIndex, tableRendering);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index d759e4421..d2788ec3b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -974,7 +974,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
return isSharedConfig(((IEditorPart) receiver).getEditorInput());
}
else if (receiver instanceof IAdaptable) {
- IFile file = (IFile) ((IAdaptable)receiver).getAdapter(IFile.class);
+ IFile file = ((IAdaptable)receiver).getAdapter(IFile.class);
if (file != null) {
return isSharedConfig(file);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
index 0e1acb39e..ab8e23e1b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
@@ -117,7 +117,7 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
* Registers command handlers for launch shortcut key bindings
*/
private void registerLaunchCommandHandlers() {
- IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
+ IHandlerService handlerService = PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
if(handlerService != null) {
for (String mode : getModes()) {
String id = getId() + "." + mode; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
index 8e13a460e..a73e12a44 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
@@ -304,7 +304,7 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
@Override
public synchronized void launchRemoved(final ILaunch launch) {
- ISuspendTrigger trigger = (ISuspendTrigger) launch.getAdapter(ISuspendTrigger.class);
+ ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
if (trigger != null) {
trigger.removeSuspendTriggerListener(this);
}
@@ -339,7 +339,7 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
@Override
public synchronized void launchAdded(ILaunch launch) {
- ISuspendTrigger trigger = (ISuspendTrigger) launch.getAdapter(ISuspendTrigger.class);
+ ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
if (trigger != null) {
trigger.addSuspendTriggerListener(this);
}
@@ -502,7 +502,7 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
String type = launchConfiguration.getType().getIdentifier();
ViewContextService service = ViewContextManager.getDefault().getService(window);
if (service != null) {
- IContextService contextServce = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
+ IContextService contextServce = PlatformUI.getWorkbench().getAdapter(IContextService.class);
String[] ids = service.getEnabledPerspectives();
IContextActivation[] activations = new IContextActivation[ids.length];
for (int i = 0; i < ids.length; i++) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
index 33707720c..f3238546b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
@@ -235,7 +235,7 @@ public class SaveScopeResourcesHandler implements IStatusHandler {
for(int i = 0; i < pages.length; i++) {
IEditorPart[] eparts = pages[i].getDirtyEditors();
for(int j = 0; j < eparts.length; j++) {
- IResource resource = (IResource)eparts[j].getEditorInput().getAdapter(IResource.class);
+ IResource resource = eparts[j].getEditorInput().getAdapter(IResource.class);
if(resource != null) {
for(int k = 0; k < projects.length; k++) {
if(projects[k].equals(resource.getProject())) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
index d57ce7108..c63c28fa0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
@@ -101,7 +101,7 @@ public class WorkingSetsFilter extends ViewerFilter {
for(int i = 0; i < wsets.length; i++) {
IAdaptable[] elements = wsets[i].getElements();
for(int j = 0; j < elements.length; j++) {
- lres = (IResource)elements[j].getAdapter(IResource.class);
+ lres = elements[j].getAdapter(IResource.class);
if(lres != null) {
if(parents.contains(lres)) {
return true;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
index e7bc9874a..fd0a4f73b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -22,12 +22,14 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
@@ -63,6 +65,7 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.ReformatAction;
import org.eclipse.debug.internal.ui.views.memory.renderings.ResetToBaseAddressAction;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingContentDescriptor;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLine;
+
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractTableRendering;
@@ -74,6 +77,7 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingSynchronizationService;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.debug.ui.memory.MemoryRenderingElement;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -83,8 +87,10 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
+
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
+
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
@@ -98,6 +104,7 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TextCellEditor;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyledText;
@@ -129,6 +136,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
@@ -1293,7 +1301,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
columnSize = syncColSize;
}
} else {
- IPersistableDebugElement elmt = (IPersistableDebugElement) getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
int defaultColSize = -1;
if (elmt != null) {
@@ -1329,7 +1337,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
} else {
int defaultRowSize = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement) getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null) {
if (elmt.supportsProperty(this, IDebugPreferenceConstants.PREF_ROW_SIZE_BY_MODEL)) {
defaultRowSize = getDefaultFromPersistableElement(IDebugPreferenceConstants.PREF_ROW_SIZE_BY_MODEL);
@@ -1371,7 +1379,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
private int getDefaultFromPersistableElement(String propertyId) {
int defaultValue = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement) getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null) {
try {
Object valueMB = elmt.getProperty(this, propertyId);
@@ -1933,23 +1941,24 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IColorProvider.class) {
- return getColorProviderAdapter();
+ return (T) getColorProviderAdapter();
}
if (adapter == ILabelProvider.class) {
- return getLabelProviderAdapter();
+ return (T) getLabelProviderAdapter();
}
if (adapter == IFontProvider.class) {
- return getFontProviderAdapter();
+ return (T) getFontProviderAdapter();
}
if (adapter == IModelChangedListener.class) {
- return fModelChangedListener;
+ return (T) fModelChangedListener;
}
if (adapter == IWorkbenchAdapter.class) {
@@ -1977,11 +1986,11 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
};
}
- return fWorkbenchAdapter;
+ return (T) fWorkbenchAdapter;
}
if (adapter == TableRenderingContentDescriptor.class) {
- return getContentDescriptor();
+ return (T) getContentDescriptor();
}
return super.getAdapter(adapter);
@@ -2675,7 +2684,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
* <code>null</code>
*/
protected IColorProvider getColorProviderAdapter() {
- return (IColorProvider) getMemoryBlock().getAdapter(IColorProvider.class);
+ return getMemoryBlock().getAdapter(IColorProvider.class);
}
/**
@@ -2692,7 +2701,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
* <code>null</code>
*/
protected ILabelProvider getLabelProviderAdapter() {
- return (ILabelProvider) getMemoryBlock().getAdapter(ILabelProvider.class);
+ return getMemoryBlock().getAdapter(ILabelProvider.class);
}
/**
@@ -2709,7 +2718,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
* <code>null</code>
*/
protected IFontProvider getFontProviderAdapter() {
- return (IFontProvider) getMemoryBlock().getAdapter(IFontProvider.class);
+ return getMemoryBlock().getAdapter(IFontProvider.class);
}
/**
@@ -2724,7 +2733,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
* <code>null</code>
*/
protected IMemoryBlockTablePresentation getTablePresentationAdapter() {
- return (IMemoryBlockTablePresentation) getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
+ return getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
}
/**
@@ -3178,8 +3187,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
fActivated = true;
IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService commandSupport = (ICommandService) workbench.getAdapter(ICommandService.class);
- IContextService contextSupport = (IContextService) workbench.getAdapter(IContextService.class);
+ ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
+ IContextService contextSupport = workbench.getAdapter(IContextService.class);
if (commandSupport != null && contextSupport != null) {
fContext.add(contextSupport.activateContext(ID_ASYNC_TABLE_RENDERING_CONTEXT));
@@ -3217,7 +3226,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
private void activatePageActions() {
IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService commandSupport = (ICommandService) workbench.getAdapter(ICommandService.class);
+ ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
if (commandSupport != null) {
Command nextPage = commandSupport.getCommand(ID_NEXT_PAGE_COMMAND);
if (fNextPageHandler == null) {
@@ -3252,8 +3261,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
fActivated = false;
IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService commandSupport = (ICommandService) workbench.getAdapter(ICommandService.class);
- IContextService contextSupport = (IContextService) workbench.getAdapter(IContextService.class);
+ ICommandService commandSupport = workbench.getAdapter(ICommandService.class);
+ IContextService contextSupport = workbench.getAdapter(IContextService.class);
if (commandSupport != null && contextSupport != null) {
// remove handler
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
index 3ca3eaf7f..87869f7ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
@@ -109,7 +109,7 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
FontData fontData = super.getFontData(elementPath, presentationContext, columnId);
if (fontData == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
fontData = adapter.getFont(element);
}
@@ -124,7 +124,7 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
RGB rgb = super.getForeground(elementPath, presentationContext, columnId);
if (rgb == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
rgb = adapter.getForeground(element);
}
@@ -139,7 +139,7 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
RGB rgb = super.getBackground(elementPath, presentationContext, columnId);
if (rgb == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
rgb = adapter.getBackground(element);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java
index 9f4c8dbb6..2c0ea6529 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java
@@ -34,7 +34,7 @@ public class BreakpointContainerMementoProvider extends DebugElementMementoProvi
IBreakpointContainer container = (IBreakpointContainer) element;
IAdaptable category = container.getCategory();
if (category != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getLabel(category);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
index 8d7282b73..0fc5d434b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
@@ -832,7 +832,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
debugTargets.add(targets[j]);
}
} else if (next instanceof IProcess) {
- IDebugTarget target = (IDebugTarget)((IProcess)next).getAdapter(IDebugTarget.class);
+ IDebugTarget target = ((IProcess)next).getAdapter(IDebugTarget.class);
if (target != null) {
debugTargets.add(target);
}
@@ -840,7 +840,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
// Allow non-standard debug model element return an IDebugTarget
// element that could be used for implementing breakpoint filtering.
// Bug 333517.
- IDebugTarget target = (IDebugTarget) ((IAdaptable)next).getAdapter(IDebugTarget.class);
+ IDebugTarget target = ((IAdaptable)next).getAdapter(IDebugTarget.class);
if (target != null) {
debugTargets.add(target);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
index 636736c5f..02e030911 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
@@ -304,7 +304,7 @@ public class RunDebugPropertiesPage extends PropertyPage {
if (element instanceof IResource) {
resource = (IResource) element;
} else if (element instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
+ resource = ((IAdaptable)element).getAdapter(IResource.class);
}
return resource;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java
index b49bd641f..e8f2429fb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 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
@@ -11,6 +11,7 @@
package org.eclipse.debug.internal.ui.sourcelookup;
import org.eclipse.core.runtime.IAdapterFactory;
+
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
@@ -22,10 +23,11 @@ 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, 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;
}
@@ -33,7 +35,7 @@ public class SourceContainerAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] {IWorkbenchAdapter.class};
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementAdapterFactory.java
index fba3c1fd0..55e76d4c9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 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
@@ -11,6 +11,7 @@
package org.eclipse.debug.internal.ui.sourcelookup;
import org.eclipse.core.runtime.IAdapterFactory;
+
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
@@ -22,10 +23,11 @@ public class SourceElementAdapterFactory 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, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType.equals(IWorkbenchAdapter.class)) {
- return new SourceElementWorkbenchAdapter();
+ return (T) new SourceElementWorkbenchAdapter();
}
return null;
}
@@ -33,7 +35,7 @@ public class SourceElementAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] {IWorkbenchAdapter.class};
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
index 3326190b9..d69938957 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
@@ -434,7 +434,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
if (editor instanceof ITextEditor) {
textEditor = (ITextEditor)editor;
} else {
- textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
+ textEditor = editor.getAdapter(ITextEditor.class);
}
if (textEditor != null) {
positionEditor(textEditor, frame);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
index d21dc2118..873088856 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -86,11 +86,11 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla
public void displaySource(Object context, IWorkbenchPage page, boolean forceSourceLookup) {
if (context instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) context;
- ISourceDisplay adapter = (ISourceDisplay) adaptable.getAdapter(ISourceDisplay.class);
+ ISourceDisplay adapter = adaptable.getAdapter(ISourceDisplay.class);
if (adapter == null && !(context instanceof PlatformObject)) {
// for objects that don't properly subclass PlatformObject to inherit default
// adapters, just delegate to the adapter factory
- adapter = (ISourceDisplay) new DebugElementAdapterFactory().getAdapter(context, ISourceDisplay.class);
+ adapter = new DebugElementAdapterFactory().getAdapter(context, ISourceDisplay.class);
}
if (adapter != null) {
adapter.displaySource(context, page, forceSourceLookup);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
index dce7853fa..2644dc4ba 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
@@ -151,7 +151,7 @@ public class SelectedResourceManager {
IWorkbenchPart part = page.getActivePart();
if(part instanceof IEditorPart) {
IEditorPart epart = (IEditorPart) part;
- resource = (IResource) epart.getEditorInput().getAdapter(IResource.class);
+ resource = epart.getEditorInput().getAdapter(IResource.class);
}
else if(part != null) {
IWorkbenchPartSite site = part.getSite();
@@ -165,7 +165,7 @@ public class SelectedResourceManager {
Iterator<?> iterator = ss.iterator();
while (iterator.hasNext() && resource == null) {
Object next = iterator.next();
- resource = (IResource) Platform.getAdapterManager().getAdapter(next, IResource.class);
+ resource = Platform.getAdapterManager().getAdapter(next, IResource.class);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
index d24d85179..484d10354 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
@@ -258,7 +258,7 @@ public abstract class AsynchronousModel {
adapter = (IModelProxyFactory) element;
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- adapter = (IModelProxyFactory) adaptable.getAdapter(IModelProxyFactory.class);
+ adapter = adaptable.getAdapter(IModelProxyFactory.class);
}
return adapter;
}
@@ -438,7 +438,7 @@ public abstract class AsynchronousModel {
adapter = (IAsynchronousLabelAdapter) element;
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- adapter = (IAsynchronousLabelAdapter) adaptable.getAdapter(IAsynchronousLabelAdapter.class);
+ adapter = adaptable.getAdapter(IAsynchronousLabelAdapter.class);
}
// if no adapter, use default (i.e. model presentation)
if (adapter == null) {
@@ -461,7 +461,7 @@ public abstract class AsynchronousModel {
adapter = (IAsynchronousContentAdapter) element;
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- adapter = (IAsynchronousContentAdapter) adaptable.getAdapter(IAsynchronousContentAdapter.class);
+ adapter = adaptable.getAdapter(IAsynchronousContentAdapter.class);
}
return adapter;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
index 1f4b9d06d..6a256f403 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
@@ -584,7 +584,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
Object element = ss.getFirstElement();
if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- IModelSelectionPolicyFactory factory = (IModelSelectionPolicyFactory) adaptable.getAdapter(IModelSelectionPolicyFactory.class);
+ IModelSelectionPolicyFactory factory = adaptable.getAdapter(IModelSelectionPolicyFactory.class);
if (factory != null) {
return factory.createModelSelectionPolicyAdapter(adaptable, getPresentationContext());
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
index 15b304571..9ec884a25 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -57,7 +57,7 @@ public class ViewerAdapterService {
IElementLabelProvider lp = (IElementLabelProvider)getAdapter(element, IElementLabelProvider.class);
if (lp == null && element instanceof String) {
// there are no adapters registered for Strings
- return (IElementLabelProvider) new DebugElementAdapterFactory().getAdapter(element, IElementLabelProvider.class);
+ return new DebugElementAdapterFactory().getAdapter(element, IElementLabelProvider.class);
}
return lp;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
index 74244bf03..224182bd4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
@@ -112,7 +112,7 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
@Override
protected boolean initialize(IAction action, ISelection selection) {
if (!isInitialized()) {
- IDebugView adapter= (IDebugView)getView().getAdapter(IDebugView.class);
+ IDebugView adapter= getView().getAdapter(IDebugView.class);
if (adapter != null) {
if (adapter.getViewer() instanceof TreeModelViewer) {
setViewer((TreeModelViewer) adapter.getViewer());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index e56f6d3b1..a39b75c56 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -623,7 +623,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
ViewContextService(IWorkbenchWindow window) {
fWindow = window;
- fContextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
+ fContextService = PlatformUI.getWorkbench().getAdapter(IContextService.class);
fDebugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
loadContextToViewExtensions();
applyUserViewBindings();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
index cdd141032..b6cfeb3c2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.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
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
+
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
@@ -29,6 +30,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+
import org.eclipse.debug.ui.IDebugUIConstants;
/**
@@ -660,7 +662,7 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
index 7a0c9dd2e..1aededf79 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
@@ -43,7 +43,7 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
if (category != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getImageDescriptor(category);
}
@@ -62,7 +62,7 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
if (category != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getLabel(category);
}
@@ -88,7 +88,7 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
if (object instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
return adapter.getForeground(category);
}
@@ -104,7 +104,7 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
if (object instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
return adapter.getBackground(category);
}
@@ -120,7 +120,7 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
if (object instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
return adapter.getFont(category);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
index 41af99aa5..3ff9bc666 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
@@ -51,7 +51,7 @@ public class BreakpointPersistableElementAdapter implements IPersistableElement
IMarker marker = fBreakpoint.getMarker();
if (marker != null) {
IResource resource = marker.getResource();
- IPersistableElement pe = (IPersistableElement) resource.getAdapter(IPersistableElement.class);
+ IPersistableElement pe = resource.getAdapter(IPersistableElement.class);
if (pe != null) {
long id = marker.getId();
String longString = Long.toString(id);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
index 2f419f2df..f90031689 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
@@ -34,7 +34,7 @@ public class BreakpointTypeOrganizer extends AbstractBreakpointOrganizerDelegate
*/
@Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IBreakpointTypeCategory category = (IBreakpointTypeCategory) breakpoint.getAdapter(IBreakpointTypeCategory.class);
+ IBreakpointTypeCategory category = breakpoint.getAdapter(IBreakpointTypeCategory.class);
if (category != null) {
return new IAdaptable[]{category};
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
index bce1bbffe..972e41ed2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
@@ -61,7 +61,7 @@ public class WorkingSetBreakpointOrganizer extends AbstractBreakpointOrganizerDe
if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSets[i].getId())) {
IAdaptable[] elements = workingSets[i].getElements();
for (int j = 0; j < elements.length; j++) {
- IResource resource = (IResource) elements[j].getAdapter(IResource.class);
+ IResource resource = elements[j].getAdapter(IResource.class);
if (resource != null) {
if (parents.contains(resource)) {
result.add(new WorkingSetCategory(workingSets[i]));
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
index 31276641a..4052537dd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.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
@@ -14,6 +14,7 @@ import java.io.IOException;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
+
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
@@ -24,14 +25,17 @@ import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.debug.core.model.IStreamsProxy2;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
+
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
+
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
+
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
@@ -161,19 +165,20 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
/* (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 (IShowInSource.class.equals(required)) {
- return this;
+ return (T) this;
}
if (IShowInTargetList.class.equals(required)) {
- return this;
+ return (T) this;
}
//CONTEXTLAUNCHING
if(ILaunchConfiguration.class.equals(required)) {
ILaunch launch = getProcess().getLaunch();
if(launch != null) {
- return launch.getLaunchConfiguration();
+ return (T) launch.getLaunchConfiguration();
}
return null;
}
@@ -189,7 +194,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
if (process == null) {
return null;
}
- IDebugTarget target = (IDebugTarget)process.getAdapter(IDebugTarget.class);
+ IDebugTarget target = process.getAdapter(IDebugTarget.class);
ISelection selection = null;
if (target == null) {
selection = new TreeSelection(new TreePath(new Object[]{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
index 874c04be6..7a6671672 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
@@ -206,7 +206,7 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
if (target instanceof IExpression) {
return (IExpression)target;
} else if (target instanceof IAdaptable) {
- return (IExpression)((IAdaptable)target).getAdapter(IExpression.class);
+ return ((IAdaptable)target).getAdapter(IExpression.class);
}
return null;
}
@@ -500,7 +500,7 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
* @return factory or <code>null</code>
*/
private IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
- return (IWatchExpressionFactoryAdapter) variable.getAdapter(IWatchExpressionFactoryAdapter.class);
+ return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
}
/**
@@ -511,7 +511,7 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
*/
private IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
if (element instanceof IAdaptable) {
- return (IWatchExpressionFactoryAdapter2)((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
+ return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
index f75f7a5cb..997f2a89f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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
@@ -13,6 +13,7 @@ package org.eclipse.debug.internal.ui.views.launch;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
@@ -122,7 +123,7 @@ class BreadcrumbWorkbenchPart implements IWorkbenchPart {
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
index 6475b0969..d0158505c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.views.launch;
import org.eclipse.core.runtime.IAdapterFactory;
+
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
@@ -85,6 +86,7 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousLabelAdapt
import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory;
import org.eclipse.debug.internal.ui.viewers.update.DefaultModelSelectionPolicyFactory;
import org.eclipse.debug.internal.ui.views.memory.renderings.MemorySegment;
+
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
/**
@@ -146,98 +148,99 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType.isInstance(adaptableObject)) {
- return adaptableObject;
+ return (T) adaptableObject;
}
if (adapterType.equals(IAsynchronousContentAdapter.class)) {
if (adaptableObject instanceof IMemoryBlockRetrieval) {
- return fgAsyncMemoryRetrieval;
+ return (T) fgAsyncMemoryRetrieval;
}
if (adaptableObject instanceof IMemoryBlock) {
- return fgAsyncMemoryBlock;
+ return (T) fgAsyncMemoryBlock;
}
}
if (adapterType.equals(IElementContentProvider.class)) {
if (adaptableObject instanceof ILaunchManager) {
- return fgCPLaunchManger;
+ return (T) fgCPLaunchManger;
}
if (adaptableObject instanceof ILaunch) {
- return fgCPLaunch;
+ return (T) fgCPLaunch;
}
if (adaptableObject instanceof IProcess) {
- return fgCPProcess;
+ return (T) fgCPProcess;
}
if (adaptableObject instanceof IDebugTarget) {
- return fgCPTarget;
+ return (T) fgCPTarget;
}
if (adaptableObject instanceof IMemoryBlockRetrieval)
{
- return fgCPMemoryRetrieval;
+ return (T) fgCPMemoryRetrieval;
}
if (adaptableObject instanceof IThread) {
- return fgCPThread;
+ return (T) fgCPThread;
}
if (adaptableObject instanceof IStackFrame) {
- return fgCPFrame;
+ return (T) fgCPFrame;
}
if (adaptableObject instanceof IVariable) {
- return fgCPVariable;
+ return (T) fgCPVariable;
}
if (adaptableObject instanceof IExpressionManager) {
- return fgCPExpressionManager;
+ return (T) fgCPExpressionManager;
}
if (adaptableObject instanceof IExpression) {
- return fgCPExpression;
+ return (T) fgCPExpression;
}
if (adaptableObject instanceof IRegisterGroup) {
- return fgCPRegisterGroup;
+ return (T) fgCPRegisterGroup;
}
if (adaptableObject instanceof IMemoryBlock) {
- return fgCPMemoryBlock;
+ return (T) fgCPMemoryBlock;
}
if (adaptableObject instanceof DefaultBreakpointsViewInput) {
- return fgCPBreakpointManager;
+ return (T) fgCPBreakpointManager;
}
if (adaptableObject instanceof IBreakpoint) {
- return fgCPBreakpoint;
+ return (T) fgCPBreakpoint;
}
}
if (adapterType.equals(IAsynchronousLabelAdapter.class)) {
if (adaptableObject instanceof IMemoryBlock) {
- return fgMemoryBlockLabelAdapter;
+ return (T) fgMemoryBlockLabelAdapter;
}
if (adaptableObject instanceof MemorySegment) {
- return fgTableRenderingLineLabelAdapter;
+ return (T) fgTableRenderingLineLabelAdapter;
}
- return fgDebugLabelAdapter;
+ return (T) fgDebugLabelAdapter;
}
if (adapterType.equals(IElementLabelProvider.class)) {
if (adaptableObject instanceof IVariable) {
- return fgLPVariable;
+ return (T) fgLPVariable;
}
if (adaptableObject instanceof IExpression) {
- return fgLPExpression;
+ return (T) fgLPExpression;
}
if (adaptableObject instanceof IRegisterGroup) {
- return fgLPRegisterGroup;
+ return (T) fgLPRegisterGroup;
}
if (adaptableObject instanceof IMemoryBlock) {
- return fgLPMemoryBlock;
+ return (T) fgLPMemoryBlock;
}
if (adaptableObject instanceof IBreakpoint) {
- return fgLPBreakpoint;
+ return (T) fgLPBreakpoint;
}
if (adaptableObject instanceof IBreakpointContainer) {
- return fgLPBreakpointContainer;
+ return (T) fgLPBreakpointContainer;
}
- return fgLPDebugElement;
+ return (T) fgLPDebugElement;
}
if (adapterType.equals(IModelProxyFactory.class)) {
@@ -249,72 +252,72 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
adaptableObject instanceof DefaultBreakpointsViewInput ||
adaptableObject instanceof IBreakpoint ||
adaptableObject instanceof IBreakpointContainer) {
- return fgModelProxyFactoryAdapter;
+ return (T) fgModelProxyFactoryAdapter;
}
}
if (adapterType.equals(ISourceDisplay.class)) {
if (adaptableObject instanceof IStackFrame) {
- return fgStackFrameSourceDisplayAdapter;
+ return (T) fgStackFrameSourceDisplayAdapter;
}
}
if (adapterType.equals(IModelSelectionPolicyFactory.class)) {
if (adaptableObject instanceof IDebugElement) {
- return fgModelSelectionPolicyFactoryAdapter;
+ return (T) fgModelSelectionPolicyFactoryAdapter;
}
}
if (adapterType.equals(IColumnPresentationFactory.class)) {
if (adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager) {
- return fgVariableColumnFactory;
+ return (T) fgVariableColumnFactory;
}
}
if (adapterType.equals(IElementMementoProvider.class)) {
if (adaptableObject instanceof IStackFrame) {
- return fgMPFrame;
+ return (T) fgMPFrame;
}
if (adaptableObject instanceof IVariable) {
- return fgMPVariable;
+ return (T) fgMPVariable;
}
if (adaptableObject instanceof IRegisterGroup) {
- return fgMPRegisterGroup;
+ return (T) fgMPRegisterGroup;
}
if (adaptableObject instanceof IExpression) {
- return fgMPExpression;
+ return (T) fgMPExpression;
}
if (adaptableObject instanceof IExpressionManager) {
- return fgMPExpressionManager;
+ return (T) fgMPExpressionManager;
}
if (adaptableObject instanceof IMemoryBlockRetrieval) {
- return fgMPMemory;
+ return (T) fgMPMemory;
}
if (adaptableObject instanceof IBreakpoint) {
- return fgMPBreakpoint;
+ return (T) fgMPBreakpoint;
}
if (adaptableObject instanceof IBreakpointContainer) {
- return fgMPBreakpointContainer;
+ return (T) fgMPBreakpointContainer;
}
if (adaptableObject instanceof DefaultBreakpointsViewInput) {
- return fgMPBreakpointManagerInput;
+ return (T) fgMPBreakpointManagerInput;
}
}
if (adapterType.equals(IElementEditor.class)) {
if (adaptableObject instanceof IVariable) {
- return fgEEVariable;
+ return (T) fgEEVariable;
}
if (adaptableObject instanceof IWatchExpression) {
- return fgEEWatchExpression;
+ return (T) fgEEWatchExpression;
}
}
if (adapterType.equals(IViewerInputProvider.class)) {
if (adaptableObject instanceof IStackFrame) {
- return fgStackFrameViewerInputProvider;
+ return (T) fgStackFrameViewerInputProvider;
} else {
- return fgDefaultViewerInputProvider;
+ return (T) fgDefaultViewerInputProvider;
}
}
@@ -325,7 +328,7 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] {
IAsynchronousLabelAdapter.class,
IAsynchronousContentAdapter.class,
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
index 570fe9ebb..1d08d4f88 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
@@ -1386,7 +1386,7 @@ public class LaunchView extends AbstractDebugView
Object object = selection.getFirstElement();
if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object;
- IShowInSource show = (IShowInSource) adaptable.getAdapter(IShowInSource.class);
+ IShowInSource show = adaptable.getAdapter(IShowInSource.class);
if (show != null) {
return show.getShowInContext();
}
@@ -1407,7 +1407,7 @@ public class LaunchView extends AbstractDebugView
Object object = selection.getFirstElement();
if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object;
- IShowInTargetList show = (IShowInTargetList) adaptable.getAdapter(IShowInTargetList.class);
+ IShowInTargetList show = adaptable.getAdapter(IShowInTargetList.class);
if (show != null) {
return show.getShowInTargetIds();
}
@@ -1524,7 +1524,7 @@ public class LaunchView extends AbstractDebugView
@Override
public synchronized void viewerUpdatesBegin() {
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.incrementBusy();
}
@@ -1536,7 +1536,7 @@ public class LaunchView extends AbstractDebugView
@Override
public synchronized void viewerUpdatesComplete() {
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.decrementBusy();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
index 38e1906d9..6756edd30 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
@@ -516,7 +516,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
}
// ask decorator to decorate to ensure consistent label
- ILabelDecorator decorator = (ILabelDecorator) fMemoryBlocks[i].getAdapter(ILabelDecorator.class);
+ ILabelDecorator decorator = fMemoryBlocks[i].getAdapter(ILabelDecorator.class);
if (decorator != null)
text = decorator.decorateText(text, fMemoryBlocks[i]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
index 2957f11e4..c14df2012 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
@@ -78,13 +78,13 @@ public class MemoryViewUtil {
if (!(elem instanceof IAdaptable))
return false;
- IMemoryBlockRetrieval memRetrieval = (IMemoryBlockRetrieval) ((IAdaptable) elem).getAdapter(IMemoryBlockRetrieval.class);
+ IMemoryBlockRetrieval memRetrieval = ((IAdaptable) elem).getAdapter(IMemoryBlockRetrieval.class);
IDebugTarget debugTarget = null;
if (elem instanceof IDebugElement) {
debugTarget = ((IDebugElement) elem).getDebugTarget();
} else {
- debugTarget = (IDebugTarget) ((IAdaptable) elem).getAdapter(IDebugTarget.class);
+ debugTarget = ((IAdaptable) elem).getAdapter(IDebugTarget.class);
}
if (memRetrieval == null) {
@@ -197,7 +197,7 @@ public class MemoryViewUtil {
// check if the object can adapt to a memory block retrieval
if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object;
- retrieval = (IMemoryBlockRetrieval) adaptable.getAdapter(IMemoryBlockRetrieval.class);
+ retrieval = adaptable.getAdapter(IMemoryBlockRetrieval.class);
}
// if cannot adapt and the object itself is already an
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
index 6eaed8d30..89b298b34 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
@@ -93,7 +93,7 @@ public class RetargetAddMemoryBlockAction extends AddMemoryBlockAction {
if (standardMemRetrieval instanceof IAddMemoryBlocksTarget) {
target = (IAddMemoryBlocksTarget) standardMemRetrieval;
} else if (standardMemRetrieval instanceof IAdaptable) {
- target = (IAddMemoryBlocksTarget) ((IAdaptable) standardMemRetrieval).getAdapter(IAddMemoryBlocksTarget.class);
+ target = ((IAdaptable) standardMemRetrieval).getAdapter(IAddMemoryBlocksTarget.class);
}
return target;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
index 8a07ecf15..26cc15d23 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
@@ -444,7 +444,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
* @return the decorated label for the specified <code>IMemoryBlock</code>
*/
private String decorateLabel(final IMemoryBlock memBlk, String label) {
- ILabelDecorator decorator = (ILabelDecorator) memBlk.getAdapter(ILabelDecorator.class);
+ ILabelDecorator decorator = memBlk.getAdapter(ILabelDecorator.class);
if (decorator != null) {
label = decorator.decorateText(label, memBlk);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java
index 3d568e8c1..32ea601cb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -97,7 +97,7 @@ public class AsyncTableRenderingUpdatePolicy extends TableUpdatePolicy
private void notifyRendering(IModelDelta node, IModelProxy proxy) {
if (getTableViewer() != null)
{
- IModelChangedListener listener = (IModelChangedListener)getTableViewer().getRendering().getAdapter(IModelChangedListener.class);
+ IModelChangedListener listener = getTableViewer().getRendering().getAdapter(IModelChangedListener.class);
if (listener != null)
listener.modelChanged(node, proxy);
}
@@ -114,7 +114,7 @@ public class AsyncTableRenderingUpdatePolicy extends TableUpdatePolicy
{
if ((delta.getFlags() & IModelDelta.CONTENT) != 0)
{
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor)rendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = rendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor != null)
{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
index 3c5d3292c..7c3b7fc94 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
@@ -95,7 +95,7 @@ public class CopyTableRenderingToClipboardAction extends Action
IMemoryBlock memBlock = fRendering.getMemoryBlock();
if (memBlock instanceof IMemoryBlockExtension)
{
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor)fRendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = fRendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor == null)
{
try {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
index ed3705a13..d610df637 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
@@ -410,7 +410,7 @@ public class FormatTableRenderingDialog extends TrayDialog
private int getDefaultRowSize()
{
int size = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement)fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null)
{
if (elmt.supportsProperty(fRendering, IDebugPreferenceConstants.PREF_ROW_SIZE_BY_MODEL))
@@ -425,7 +425,7 @@ public class FormatTableRenderingDialog extends TrayDialog
private int getDefaultColumnSize()
{
int size = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement)fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null)
{
if (elmt.supportsProperty(fRendering, IDebugPreferenceConstants.PREF_COL_SIZE_BY_MODEL))
@@ -465,7 +465,7 @@ public class FormatTableRenderingDialog extends TrayDialog
int columnSize = fColumnSizes[fColumnControl.getSelectionIndex()];
int rowSize = fRowSizes[fRowControl.getSelectionIndex()];
- IPersistableDebugElement elmt = (IPersistableDebugElement)fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null && elmt.supportsProperty(fRendering, IDebugPreferenceConstants.PREF_ROW_SIZE_BY_MODEL)
&& elmt.supportsProperty(fRendering, IDebugPreferenceConstants.PREF_COL_SIZE_BY_MODEL))
@@ -549,7 +549,7 @@ public class FormatTableRenderingDialog extends TrayDialog
private int getDefaultFromPersistableElement(String propertyId) {
int defaultValue = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement)fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = fRendering.getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null)
{
try {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
index 71ebac1d2..ef3f1e9a6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
@@ -113,7 +113,7 @@ public class PrintTableRenderingAction extends Action
charsPerByte = 4;
int addressSizeInBytes = 0;
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor)fRendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = fRendering.getAdapter(TableRenderingContentDescriptor.class);
if (descriptor == null)
{
// special for address column
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java
index 62bd36369..90182653e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -13,10 +13,12 @@ package org.eclipse.debug.internal.ui.views.memory.renderings;
import java.math.BigInteger;
import org.eclipse.core.runtime.PlatformObject;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.internal.ui.memory.provisional.AbstractAsyncTableRendering;
+
import org.eclipse.debug.ui.memory.AbstractTableRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering;
@@ -105,10 +107,11 @@ public class TableRenderingContentInput extends PlatformObject {
public void updateContentBaseAddress() throws DebugException {
IMemoryBlock memoryBlock = fRendering.getMemoryBlock();
- if (memoryBlock instanceof IMemoryBlockExtension)
+ if (memoryBlock instanceof IMemoryBlockExtension) {
fMemoryBlockBaseAddress = ((IMemoryBlockExtension)memoryBlock).getBigBaseAddress();
- else
+ } else {
fMemoryBlockBaseAddress = BigInteger.valueOf(memoryBlock.getStartAddress());
+ }
}
/**
@@ -123,16 +126,18 @@ public class TableRenderingContentInput extends PlatformObject {
if(memoryBlock instanceof IMemoryBlockExtension)
{
BigInteger startAddress = ((IMemoryBlockExtension)memoryBlock).getMemoryBlockStartAddress();
- if (startAddress != null)
+ if (startAddress != null) {
fStartAddress = startAddress;
+ }
}
} catch (DebugException e) {
// default to 0 if we have trouble getting the start address
fStartAddress = BigInteger.valueOf(0);
}
- if (fStartAddress == null)
+ if (fStartAddress == null) {
fStartAddress = BigInteger.valueOf(0);
+ }
}
return fStartAddress;
}
@@ -150,8 +155,9 @@ public class TableRenderingContentInput extends PlatformObject {
BigInteger endAddress;
try {
endAddress = ((IMemoryBlockExtension)memoryBlock).getMemoryBlockEndAddress();
- if (endAddress != null)
+ if (endAddress != null) {
fEndAddress = endAddress;
+ }
} catch (DebugException e) {
fEndAddress = null;
}
@@ -172,8 +178,9 @@ public class TableRenderingContentInput extends PlatformObject {
}
}
- if (fEndAddress == null)
+ if (fEndAddress == null) {
fEndAddress = BigInteger.valueOf(Integer.MAX_VALUE);
+ }
}
return fEndAddress;
}
@@ -188,17 +195,20 @@ public class TableRenderingContentInput extends PlatformObject {
fNumLines = numLines;
}
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == AbstractTableRendering.class)
{
- if (fRendering instanceof AbstractTableRendering)
- return fRendering;
+ if (fRendering instanceof AbstractTableRendering) {
+ return (T) fRendering;
+ }
}
if (adapter == AbstractAsyncTableRendering.class)
{
- if (fRendering instanceof AbstractAsyncTableRendering)
- return fRendering;
+ if (fRendering instanceof AbstractAsyncTableRendering) {
+ return (T) fRendering;
+ }
}
return super.getAdapter(adapter);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index 51d14a938..5848db937 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -94,10 +94,11 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
if (newInput instanceof TableRenderingContentInput)
{
fInput = (TableRenderingContentInput)newInput;
- if (fInput.getMemoryBlock() instanceof IMemoryBlockExtension)
+ if (fInput.getMemoryBlock() instanceof IMemoryBlockExtension) {
loadContentForExtendedMemoryBlock();
- else
+ } else {
loadContentForSimpleMemoryBlock();
+ }
// tell rendering to display table if the loading is successful
getTableRendering(fInput).displayTable();
@@ -131,8 +132,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
}
}
- if (lineCache.isEmpty())
+ if (lineCache.isEmpty()) {
return lineCache.toArray();
+ }
// check to see if the row size has changed
TableRenderingLine line = lineCache.get(0);
@@ -187,8 +189,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
public void loadContentForExtendedMemoryBlock() throws DebugException {
// do not load if number of lines needed is < 0
- if (fInput.getNumLines() <= 0)
+ if (fInput.getNumLines() <= 0) {
return;
+ }
// calculate top buffered address
BigInteger loadAddress = fInput.getLoadAddress();
@@ -221,8 +224,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
if (isDynamicLoad())
{
- if (bufferStart.compareTo(mbStart) < 0)
+ if (bufferStart.compareTo(mbStart) < 0) {
bufferStart = mbStart;
+ }
if (bufferEnd.compareTo(mbEnd) > 0)
{
@@ -238,13 +242,15 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// if after adjusting buffer start, it goes before the memory block start
// address, adjust it back
- if (bufferStart.compareTo(mbStart) < 0)
+ if (bufferStart.compareTo(mbStart) < 0) {
bufferStart = mbStart;
+ }
}
// buffer end must be greater than buffer start
- if (bufferEnd.compareTo(bufferStart) <= 0)
+ if (bufferEnd.compareTo(bufferStart) <= 0) {
throw new DebugException(DebugUIPlugin.newErrorStatus(DebugUIMessages.TableRenderingContentProvider_1, null));
+ }
int numLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;
// get stoarage to fit the memory view tab size
@@ -252,8 +258,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
}
else
{
- if (bufferStart.compareTo(mbStart) < 0)
+ if (bufferStart.compareTo(mbStart) < 0) {
bufferStart = mbStart;
+ }
if (bufferEnd.compareTo(mbEnd) > 0)
{
@@ -261,19 +268,22 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
bufferEnd = mbEnd;
// after adjusting buffer start, check if it's smaller than memory block's start address
- if (bufferStart.compareTo(mbStart) < 0)
+ if (bufferStart.compareTo(mbStart) < 0) {
bufferStart = mbStart;
+ }
}
// buffer end must be greater than buffer start
- if (bufferEnd.compareTo(bufferStart) <= 0)
+ if (bufferEnd.compareTo(bufferStart) <= 0) {
throw new DebugException(DebugUIPlugin.newErrorStatus(DebugUIMessages.TableRenderingContentProvider_2, null));
+ }
int numLines = fInput.getNumLines();
int bufferNumLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;
- if (bufferNumLines < numLines)
+ if (bufferNumLines < numLines) {
numLines = bufferNumLines;
+ }
// get stoarage to fit the memory view tab size
getMemoryToFitTable(bufferStart, numLines, fInput.isUpdateDelta());
@@ -300,8 +310,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// is already terminated
IDebugTarget target = fInput.getMemoryBlock().getDebugTarget();
- if (target.isDisconnected() || target.isTerminated())
+ if (target.isDisconnected() || target.isTerminated()) {
return;
+ }
DebugException dbgEvt = null;
@@ -544,10 +555,11 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
if (manageDelta)
{
- if (oldLine != null)
+ if (oldLine != null) {
newLine.isMonitored = true;
- else
+ } else {
newLine.isMonitored = false;
+ }
}
else
{
@@ -631,17 +643,20 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// only do this if it's visible
// still need to clear content cache if the rendering
// is not visible
- if (isUpdateManagedByMB())
+ if (isUpdateManagedByMB()) {
return;
+ }
}
// do nothing if the debug event did not come from a debug element comes from non-debug element
- if (!(event.getSource() instanceof IDebugElement))
+ if (!(event.getSource() instanceof IDebugElement)) {
return;
+ }
// do not try to recover if the content input has not been created
- if (fInput == null)
+ if (fInput == null) {
return;
+ }
IDebugElement src = (IDebugElement)event.getSource();
@@ -686,8 +701,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
takeContentSnapshot();
//do not handle event if the rendering is not visible
- if (!getTableRendering(fInput).isVisible())
- return;
+ if (!getTableRendering(fInput).isVisible()) {
+ return;
+ }
getTableRendering(fInput).refresh();
@@ -709,8 +725,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
}
//do not handle event if the rendering is not visible
- if (!getTableRendering(fInput).isVisible())
- return;
+ if (!getTableRendering(fInput).isVisible()) {
+ return;
+ }
// use existing lines as cache is the rendering is not currently displaying
// error. Otherwise, leave contentCache empty as we do not have updated
@@ -809,8 +826,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
TableRenderingLine first = lineCache.firstElement();
TableRenderingLine last = lineCache.lastElement();
- if (first == null ||last == null)
+ if (first == null ||last == null) {
return true;
+ }
BigInteger startAddress = new BigInteger(first.getAddress(), 16);
BigInteger lastAddress = new BigInteger(last.getAddress(), 16);
@@ -847,13 +865,15 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
managedMB = (IMemoryRenderingUpdater)memoryBlock;
}
- if (managedMB == null)
- managedMB = (IMemoryRenderingUpdater)memoryBlock.getAdapter(IMemoryRenderingUpdater.class);
+ if (managedMB == null) {
+ managedMB = memoryBlock.getAdapter(IMemoryRenderingUpdater.class);
+ }
// do not handle event if if the memory block wants to do its
// own update
- if (managedMB != null && managedMB.supportsManagedUpdate(getTableRendering(fInput)))
+ if (managedMB != null && managedMB.supportsManagedUpdate(getTableRendering(fInput))) {
return true;
+ }
return false;
}
@@ -875,8 +895,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
private void reorganizeLines(Vector<TableRenderingLine> lines, int numBytesPerLine) throws DebugException
{
- if (lines == null || lines.isEmpty())
+ if (lines == null || lines.isEmpty()) {
return;
+ }
Object[] objs = lines.toArray();
@@ -912,8 +933,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
{
// if content cache is empty, do nothing
if (contentCache == null || contentCache.isEmpty()
- || fContentCacheInBytes.length == 0 || fContentCacheStartAddress == null)
+ || fContentCacheInBytes.length == 0 || fContentCacheStartAddress == null) {
return;
+ }
MemoryByte[] bytes = fContentCacheInBytes;
TableRenderingLine[] convertedLines = convertBytesToLines(bytes, bytesPerLine, new BigInteger(fContentCacheStartAddress, 16));
@@ -984,6 +1006,6 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
private AbstractTableRendering getTableRendering(TableRenderingContentInput input)
{
- return (AbstractTableRendering)input.getAdapter(AbstractTableRendering.class);
+ return input.getAdapter(AbstractTableRendering.class);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java
index 5623ba8ef..3718c163c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -35,7 +35,7 @@ public class TableRenderingLabelProvider extends AbstractTableRenderingLabelProv
public TableRenderingLabelProvider(AbstractTableRendering rendering){
super(rendering);
- fTablePresentation = (IMemoryBlockTablePresentation)rendering.getAdapter(IMemoryBlockTablePresentation.class);
+ fTablePresentation = rendering.getAdapter(IMemoryBlockTablePresentation.class);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java
index 40f059d7b..c3ab9d8e3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -39,9 +39,9 @@ public class TableRenderingLabelProviderEx extends TableRenderingLabelProvider i
public TableRenderingLabelProviderEx(AbstractTableRendering rendering) {
super(rendering);
- fLabelProvider = (ILabelProvider) rendering.getAdapter(ILabelProvider.class);
- fColorProvider = (IColorProvider) rendering.getAdapter(IColorProvider.class);
- fFontProvider = (IFontProvider) rendering.getAdapter(IFontProvider.class);
+ fLabelProvider = rendering.getAdapter(ILabelProvider.class);
+ fColorProvider = rendering.getAdapter(IColorProvider.class);
+ fFontProvider = rendering.getAdapter(IFontProvider.class);
}
/*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
index 6cf038350..998e8e508 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -264,7 +264,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
clearCache();
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor) rendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = rendering.getAdapter(TableRenderingContentDescriptor.class);
boolean alignAddress = true;
if (descriptor != null && !descriptor.isAlignAddressToBoundary()) {
alignAddress = descriptor.isAlignAddressToBoundary();
@@ -301,7 +301,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
int addressableSize = rendering.getAddressableSize();
- TableRenderingContentDescriptor descriptor = (TableRenderingContentDescriptor) rendering.getAdapter(TableRenderingContentDescriptor.class);
+ TableRenderingContentDescriptor descriptor = rendering.getAdapter(TableRenderingContentDescriptor.class);
boolean alignAddress = true;
if (descriptor != null && !descriptor.isAlignAddressToBoundary()) {
alignAddress = descriptor.isAlignAddressToBoundary();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
index ae7f4c411..578910e77 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
@@ -131,7 +131,7 @@ public class ModulesView extends VariablesView {
if (context instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) context;
if (adaptable.getAdapter(IHelpContextIdProvider.class) != null) {
- IHelpContextIdProvider provider = (IHelpContextIdProvider) adaptable
+ IHelpContextIdProvider provider = adaptable
.getAdapter(IHelpContextIdProvider.class);
String helpId = provider.getHelpContextId(IDebugHelpContextIds.MODULES_VIEW);
if (helpId != null) {
@@ -164,7 +164,7 @@ public class ModulesView extends VariablesView {
if (context instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) context;
if (adaptable.getAdapter(ILabelProvider.class) != null) {
- ILabelProvider provider = (ILabelProvider) adaptable
+ ILabelProvider provider = adaptable
.getAdapter(ILabelProvider.class);
String label = provider.getText(this);
if (label != null)
@@ -179,7 +179,7 @@ public class ModulesView extends VariablesView {
if (context instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) context;
if (adaptable.getAdapter(ILabelProvider.class) != null) {
- ILabelProvider provider = (ILabelProvider) adaptable
+ ILabelProvider provider = adaptable
.getAdapter(ILabelProvider.class);
Image image = provider.getImage(this);
if (image != null)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java
index 33a0952fb..67be772b6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 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
@@ -128,7 +128,7 @@ public class IndexedValuePartition implements IIndexedValue {
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return fValue.getAdapter(adapter);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java
index 93ec5fd68..4b9cd843e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java
@@ -123,7 +123,7 @@ public abstract class VariableViewToggleAction implements IViewActionDelegate, I
}
protected StructuredViewer getStructuredViewer() {
- IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class);
+ IDebugView view = getView().getAdapter(IDebugView.class);
if (view != null) {
Viewer viewer = view.getViewer();
if (viewer instanceof StructuredViewer) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index 4e295beb6..1e43e7e4a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -1516,7 +1516,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
public synchronized void viewerUpdatesBegin() {
fTriggerDetailsJob.cancel();
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.incrementBusy();
}
@@ -1531,7 +1531,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
fTriggerDetailsJob.schedule();
}
IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (progressService != null) {
progressService.decrementBusy();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
index 51e753bb3..823db6fdd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -17,13 +17,16 @@ import java.util.Iterator;
import java.util.ResourceBundle;
import org.eclipse.core.commands.operations.IUndoContext;
+
import org.eclipse.core.resources.IMarker;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
@@ -42,11 +45,13 @@ import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneWordWra
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.views.variables.IndexedValuePartition;
+
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.IDetailPane2;
import org.eclipse.debug.ui.IValueDetailListener;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -56,6 +61,7 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.StatusLineContributionItem;
import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.resource.JFaceResources;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.DocumentEvent;
@@ -69,12 +75,14 @@ import org.eclipse.jface.text.IUndoManagerExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
@@ -90,6 +98,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.PlatformUI;
@@ -102,6 +111,7 @@ import org.eclipse.ui.operations.OperationHistoryActionHandler;
import org.eclipse.ui.operations.RedoActionHandler;
import org.eclipse.ui.operations.UndoActionHandler;
import org.eclipse.ui.progress.WorkbenchJob;
+
import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -212,7 +222,7 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
IBreakpointContainer c = (IBreakpointContainer) element;
IAdaptable category = c.getCategory();
if (category != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
message = adapter.getLabel(category);
} else {
@@ -739,13 +749,14 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class required) {
+ public <T> T getAdapter(Class<T> required) {
if (IFindReplaceTarget.class.equals(required)) {
- return fSourceViewer.getFindReplaceTarget();
+ return (T) fSourceViewer.getFindReplaceTarget();
}
if (ITextViewer.class.equals(required)) {
- return fSourceViewer;
+ return (T) fSourceViewer;
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
index 5d3709a4c..33b81d5d2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
@@ -80,7 +80,7 @@ public abstract class DebugPopup extends PopupDialog {
protected String getInfoText() {
if (getCommandId() != null && getActionText() != null) {
IWorkbench workbench = PlatformUI.getWorkbench();
- IBindingService bindingService = (IBindingService) workbench.getAdapter(IBindingService.class);
+ IBindingService bindingService = workbench.getAdapter(IBindingService.class);
String formattedBinding = bindingService.getBestActiveBindingFormattedFor(getCommandId());
String infoText = null;
@@ -198,7 +198,7 @@ public abstract class DebugPopup extends PopupDialog {
}
};
- fHandlerService = (IHandlerService) workbench.getAdapter(IHandlerService.class);
+ fHandlerService = workbench.getAdapter(IHandlerService.class);
fActivation = fHandlerService.activateHandler(commandId, fCloseHandler);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index cb5b1b94e..c6c85731e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -19,8 +19,10 @@ import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.commands.operations.ObjectUndoContext;
+
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -29,6 +31,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -57,6 +60,7 @@ import org.eclipse.debug.internal.ui.memory.MemoryRenderingManager;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIUtils;
import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager;
+
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManager;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextManager;
@@ -64,15 +68,18 @@ import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.sourcelookup.ISourceContainerBrowser;
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
+
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
+
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
@@ -309,10 +316,11 @@ public class DebugUITools {
IAdaptable context= null;
if (shell != null) {
context= new IAdaptable() {
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == Shell.class) {
- return shell;
+ return (T) shell;
}
return null;
}
@@ -477,7 +485,7 @@ public class DebugUITools {
}
if (context != null) {
- return (IProcess) context.getAdapter(IProcess.class);
+ return context.getAdapter(IProcess.class);
}
return null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java
index 3f7c9bff8..328285370 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java
@@ -457,7 +457,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab {
IAdaptable[] elements = workingSet.getElements();
IResource[] resources = new IResource[elements.length];
for (int i = 0; i < resources.length; i++) {
- resources[i]= (IResource) elements[i].getAdapter(IResource.class);
+ resources[i]= elements[i].getAdapter(IResource.class);
}
return RefreshUtil.toMemento(resources);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
index bd3ef6b95..892e30696 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
@@ -272,7 +272,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
}
else if (elmt instanceof IAdaptable)
{
- target = (IAddMemoryRenderingsTarget)((IAdaptable)elmt).getAdapter(IAddMemoryRenderingsTarget.class);
+ target = ((IAdaptable)elmt).getAdapter(IAddMemoryRenderingsTarget.class);
}
return target;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
index b09b9fdbf..05ad9edd1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
@@ -133,14 +133,14 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate
fCallerAction = callerAction;
fCallerAction.setMenuCreator(this);
- fEditor= (ITextEditor)(targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class));
+ fEditor= targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class);
if (fEditor != null) {
if (fEditor instanceof ITextEditorExtension) {
((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
}
- fRulerInfo= (IVerticalRulerInfo) fEditor.getAdapter(IVerticalRulerInfo.class);
+ fRulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
index d735d34c4..0372d40f3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
@@ -194,7 +194,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow();
IDebugContextService service = manager.getContextService(workbenchWindow);
service.addDebugContextListener(fContextListener);
- fPartTarget = (IRunToLineTarget) part.getAdapter(IRunToLineTarget.class);
+ fPartTarget = part.getAdapter(IRunToLineTarget.class);
if (fPartTarget == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
// TODO: we could restrict loading to cases when the debugging context is on
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
index 4db1b058c..7e6222cb4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
@@ -73,7 +73,7 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana
if (source instanceof IThread && event.getKind() == DebugEvent.SUSPEND &&
event.getDetail() == DebugEvent.BREAKPOINT) {
IThread thread = (IThread) source;
- IDebugTarget suspendee = (IDebugTarget) thread.getAdapter(IDebugTarget.class);
+ IDebugTarget suspendee = thread.getAdapter(IDebugTarget.class);
if (fTarget.equals(suspendee)) {
// cleanup if the breakpoint was hit or not
cancel();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
index 8a4c9c8a6..f41cad7f3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
@@ -178,7 +178,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate {
return provider.getDocument(editor.getEditorInput());
}
- IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
+ IDocument doc = fPart.getAdapter(IDocument.class);
if (doc != null) {
return doc;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
index aa3d73139..32962f107 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
@@ -86,7 +86,7 @@ public class FileLink implements IConsoleHyperlink {
if (editorPart instanceof ITextEditor) {
textEditor = (ITextEditor) editorPart;
} else {
- textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
+ textEditor = editorPart.getAdapter(ITextEditor.class);
}
if (textEditor != null) {
IEditorInput input = editorPart.getEditorInput();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
index cb4f4823d..935614696 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
@@ -106,7 +106,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
fContainer = container;
fMemoryBlock = block;
- fLabelDecorator = (ILabelDecorator)fMemoryBlock.getAdapter(ILabelDecorator.class);
+ fLabelDecorator = fMemoryBlock.getAdapter(ILabelDecorator.class);
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index 2db7b143b..a7f80721d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -16,6 +16,7 @@ import java.math.BigInteger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
@@ -42,8 +43,10 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingConte
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProvider;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProviderEx;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLine;
+
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -51,8 +54,10 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
+
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
+
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
@@ -63,6 +68,7 @@ import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.TableCursor;
@@ -97,6 +103,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyDialogAction;
@@ -1037,7 +1044,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
}
else
{
- IPersistableDebugElement elmt = (IPersistableDebugElement)getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
int defaultColSize = -1;
if (elmt != null)
@@ -1079,7 +1086,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
else
{
int defaultRowSize = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement)getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null)
{
if (elmt.supportsProperty(this, IDebugPreferenceConstants.PREF_ROW_SIZE_BY_MODEL))
@@ -1103,7 +1110,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
private int getDefaultFromPersistableElement(String propertyId) {
int defaultValue = -1;
- IPersistableDebugElement elmt = (IPersistableDebugElement)getMemoryBlock().getAdapter(IPersistableDebugElement.class);
+ IPersistableDebugElement elmt = getMemoryBlock().getAdapter(IPersistableDebugElement.class);
if (elmt != null)
{
try {
@@ -3426,23 +3433,24 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IColorProvider.class) {
- return getColorProviderAdapter();
+ return (T) getColorProviderAdapter();
}
if (adapter == ILabelProvider.class) {
- return getLabelProviderAdapter();
+ return (T) getLabelProviderAdapter();
}
if (adapter == IFontProvider.class) {
- return getFontProviderAdapter();
+ return (T) getFontProviderAdapter();
}
if (adapter == IMemoryBlockTablePresentation.class) {
- return getTablePresentationAdapter();
+ return (T) getTablePresentationAdapter();
}
if (adapter == IWorkbenchAdapter.class)
@@ -3471,7 +3479,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
}
};
}
- return fWorkbenchAdapter;
+ return (T) fWorkbenchAdapter;
}
if (adapter == IMemoryBlockConnection.class) {
@@ -3537,7 +3545,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
}
};
}
- return fConnection;
+ return (T) fConnection;
}
return super.getAdapter(adapter);
@@ -3587,7 +3595,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
protected IColorProvider getColorProviderAdapter()
{
- return (IColorProvider)getMemoryBlock().getAdapter(IColorProvider.class);
+ return getMemoryBlock().getAdapter(IColorProvider.class);
}
/**
@@ -3604,7 +3612,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
protected ILabelProvider getLabelProviderAdapter()
{
- return (ILabelProvider)getMemoryBlock().getAdapter(ILabelProvider.class);
+ return getMemoryBlock().getAdapter(ILabelProvider.class);
}
/**
@@ -3621,7 +3629,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
protected IFontProvider getFontProviderAdapter()
{
- return (IFontProvider)getMemoryBlock().getAdapter(IFontProvider.class);
+ return getMemoryBlock().getAdapter(IFontProvider.class);
}
/**
@@ -3636,7 +3644,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
protected IMemoryBlockTablePresentation getTablePresentationAdapter()
{
- return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
+ return getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class);
}
private boolean isDynamicLoad()
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
index 36ef02631..e6a338181 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
@@ -182,11 +182,11 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
return;
}
if (selection.getAdapter(ILaunch.class) != null ) {
- launch = (ILaunch) selection.getAdapter(ILaunch.class);
+ launch = selection.getAdapter(ILaunch.class);
locator = launch.getSourceLocator();
}
else if (selection.getAdapter(IDebugElement.class) != null ) {
- launch = ((IDebugElement)selection.getAdapter(IDebugElement.class)).getLaunch();
+ launch = selection.getAdapter(IDebugElement.class).getLaunch();
locator = launch.getSourceLocator();
}
else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
index 62ada047d..de724381b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
@@ -96,7 +96,7 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{
ArrayList<ISourceContainer> locationList = new ArrayList<ISourceContainer>();
for (int i = 0; i < elements.length; i++) {
- IResource resource = (IResource) elements[i].getAdapter(IResource.class);
+ IResource resource = elements[i].getAdapter(IResource.class);
if (resource != null) {
switch (resource.getType()) {

Back to the top