diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug')
4 files changed, 17 insertions, 23 deletions
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 bf50966bd..0266b07de 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 @@ -29,14 +29,13 @@ import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; /** * Generic abstract class for the actions associated to the java watch * expressions. */ public abstract class WatchExpressionAction implements IViewActionDelegate { - IWorkbenchPart fPart = null; + IViewPart fPart = null; private static IWatchExpression[] EMPTY_EXPRESSION_ARRAY = new IWatchExpression[0]; @@ -110,8 +109,8 @@ public abstract class WatchExpressionAction implements IViewActionDelegate { * @param message the message to display */ protected void showErrorMessage(String message) { - if (fPart instanceof IViewPart) { - IViewSite viewSite = ((IViewPart) fPart).getViewSite(); + if (fPart != null) { + IViewSite viewSite = fPart.getViewSite(); IStatusLineManager manager = viewSite.getActionBars().getStatusLineManager(); manager.setErrorMessage(message); } 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 50cff0042..9f497e2aa 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 @@ -299,12 +299,12 @@ public class RunDebugPropertiesPage extends PropertyPage { * @return resource */ protected IResource getResource() { - Object element = getElement(); + IAdaptable element = getElement(); IResource resource = null; if (element instanceof IResource) { resource = (IResource) element; - } else if (element instanceof IAdaptable) { - resource = ((IAdaptable)element).getAdapter(IResource.class); + } else if (element != null) { + resource = element.getAdapter(IResource.class); } return resource; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java index a0b978763..98fdaebfa 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java @@ -143,22 +143,21 @@ public abstract class TreeViewerDropDown { @Override public void mouseMove(MouseEvent e) { if (tree.equals(e.getSource())) { - Object o= tree.getItem(new Point(e.x, e.y)); - if (fLastItem == null ^ o == null) { - tree.setCursor(o == null ? null : tree.getDisplay() + TreeItem currentItem = tree.getItem(new Point(e.x, e.y)); + if (fLastItem == null ^ currentItem == null) { + tree.setCursor(currentItem == null ? null : tree.getDisplay() .getSystemCursor(SWT.CURSOR_HAND)); } - if (o instanceof TreeItem) { - TreeItem currentItem= (TreeItem) o; - if (!o.equals(fLastItem)) { - fLastItem= (TreeItem) o; + if (currentItem != null) { + if (!currentItem.equals(fLastItem)) { + fLastItem = currentItem; tree.setSelection(new TreeItem[] { fLastItem }); } else if (System.currentTimeMillis() > (fLastScrollTime + MOUSE_MOVE_SCROLL_DELAY)) { if (e.y < tree.getItemHeight() / 4) { // Scroll up if (currentItem.getParentItem() == null) { - int index= tree.indexOf((TreeItem) o); + int index = tree.indexOf(currentItem); if (index < 1) { return; } @@ -177,7 +176,7 @@ public abstract class TreeViewerDropDown { } else if (e.y > tree.getBounds().height - tree.getItemHeight() / 4) { // Scroll down if (currentItem.getParentItem() == null) { - int index= tree.indexOf((TreeItem) o); + int index = tree.indexOf(currentItem); if (index >= tree.getItemCount() - 1) { return; } @@ -195,7 +194,7 @@ public abstract class TreeViewerDropDown { } } } - } else if (o == null) { + } else { fLastItem = null; } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java index 564b2b35f..a7460f9df 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java @@ -60,9 +60,7 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter { } else if (fView != null) { ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (fPath != null && selection instanceof ITreeSelection) { - if (selection instanceof ITreeSelection) { - return fView.performDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection()); - } + return fView.performDrop(fPath, (ITreeSelection) selection); } } return false; @@ -99,9 +97,7 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter { } else { ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (fPath != null && selection instanceof ITreeSelection) { - if (selection instanceof ITreeSelection) { - return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection()); - } + return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection()); } } return false; |