diff options
4 files changed, 31 insertions, 23 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java index ae4273452..817e9a730 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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,6 +12,7 @@ package org.eclipse.debug.internal.ui.views.breakpoints; import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.util.TransferDragSourceListener; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ISelection; @@ -22,7 +23,6 @@ import org.eclipse.swt.dnd.DragSourceAdapter; import org.eclipse.swt.dnd.DragSourceEvent; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Item; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; /** * A drag adapter for the breakpoints viewer @@ -56,7 +56,7 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe * @see TransferDragSourceListener#getTransfer */ public Transfer getTransfer() { - return LocalSelectionTransfer.getInstance(); + return LocalSelectionTransfer.getTransfer(); } /* non Java-doc @@ -64,8 +64,8 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe */ public void dragStart(DragSourceEvent event) { ISelection selection = fViewer.getSelection(); - LocalSelectionTransfer.getInstance().setSelection(selection); - LocalSelectionTransfer.getInstance().setSelectionSetTime(event.time & 0xFFFFFFFFL); + LocalSelectionTransfer.getTransfer().setSelection(selection); + LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL); if (fViewer instanceof BreakpointsViewer) { BreakpointsViewer viewer = (BreakpointsViewer)fViewer; fItems = viewer.getSelectedItems(); @@ -87,7 +87,7 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe // For consistency set the data to the selection even though // the selection is provided by the LocalSelectionTransfer // to the drop target adapter. - event.data = LocalSelectionTransfer.getInstance().getSelection(); + event.data = LocalSelectionTransfer.getTransfer().getSelection(); } /* non Java-doc @@ -104,7 +104,7 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe } } fItems = null; - LocalSelectionTransfer.getInstance().setSelection(null); - LocalSelectionTransfer.getInstance().setSelectionSetTime(0); + LocalSelectionTransfer.getTransfer().setSelection(null); + LocalSelectionTransfer.getTransfer().setSelectionSetTime(0); } } 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 1cf985096..422cea9c6 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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.breakpoints; import java.util.ArrayList; import java.util.List; +import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeSelection; @@ -24,7 +25,6 @@ import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.swt.dnd.TransferData; import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; /** * BreakpointsDropAdapter @@ -54,12 +54,12 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter { public boolean performDrop(Object data) { // This is temporary if (getViewer() instanceof BreakpointsViewer) { - return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection()); + return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection()); } else if (fView != null) { - ISelection selection = LocalSelectionTransfer.getInstance().getSelection(); + ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (fPath != null && selection instanceof ITreeSelection) { if (selection instanceof ITreeSelection) { - return fView.performDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getInstance().getSelection()); + return fView.performDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection()); } } } @@ -91,12 +91,12 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter { public boolean validateDrop(Object target, int operation, TransferData transferType) { // This is temporary if (getViewer() instanceof BreakpointsViewer) { - return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection()); + return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection()); } else { - ISelection selection = LocalSelectionTransfer.getInstance().getSelection(); + ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (fPath != null && selection instanceof ITreeSelection) { if (selection instanceof ITreeSelection) { - return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getInstance().getSelection()); + return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection()); } } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java index d31ebecc2..b77bec40d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java @@ -54,6 +54,7 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.Separator; +import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeSelection; @@ -72,9 +73,7 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.SelectionListenerAction; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; /** * This class implements the breakpoints view. @@ -198,7 +197,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager menu.add(getAction(ACTION_GOTO_MARKER)); menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP)); menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP)); - menu.add(getAction(ActionFactory.PASTE.getCommandId())); + menu.add(getAction(PASTE_ACTION)); IAction action = getAction(ACTION_REMOVE_FROM_GROUP); if (action != null && action.isEnabled()) { menu.add(action); @@ -228,7 +227,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager fClipboard = new Clipboard(getSite().getShell().getDisplay()); PasteBreakpointsAction paste = new PasteBreakpointsAction(this); - configure(paste, ActionFactory.PASTE.getCommandId(), ActionFactory.PASTE.getCommandId(), ISharedImages.IMG_TOOL_PASTE); + configure(paste, PASTE_ACTION, PASTE_ACTION, ISharedImages.IMG_TOOL_PASTE); SelectionListenerAction remove = new RemoveFromWorkingSetAction(this); setAction(ACTION_REMOVE_FROM_GROUP, remove); @@ -395,9 +394,9 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager protected void initDragAndDrop(TreeModelViewer viewer) { int ops = DND.DROP_MOVE | DND.DROP_COPY; // drop - viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer, this)); + viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDropAdapter(viewer, this)); // Drag - viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer, this)); + viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDragAdapter(viewer, this)); } /* 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 356401335..819647097 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 @@ -329,10 +329,15 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis protected static final String VARIABLES_SELECT_ALL_ACTION = SELECT_ALL_ACTION + ".Variables"; //$NON-NLS-1$ /** - * Key for "Select All" action. + * Key for "Copy" action. */ protected static final String VARIABLES_COPY_ACTION = COPY_ACTION + ".Variables"; //$NON-NLS-1$ + /** + * Key for "Paste" action. + */ + protected static final String VARIABLES_PASTE_ACTION = PASTE_ACTION + ".Variables"; //$NON-NLS-1$ + /** * Visits deltas to determine if details should be displayed */ @@ -650,6 +655,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis fSelectionProvider.setActiveProvider(variablesViewer); setAction(SELECT_ALL_ACTION, getAction(VARIABLES_SELECT_ALL_ACTION)); setAction(COPY_ACTION, getAction(VARIABLES_COPY_ACTION)); + setAction(PASTE_ACTION, getAction(VARIABLES_PASTE_ACTION)); setAction(FIND_ACTION, getAction(VARIABLES_FIND_ELEMENT_ACTION)); getViewSite().getActionBars().updateActionBars(); } @@ -659,6 +665,8 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis setAction(SELECT_ALL_ACTION, null); setAction(COPY_ACTION,null); setAction(FIND_ACTION, null); + setAction(PASTE_ACTION, null); + getViewSite().getActionBars().clearGlobalActionHandlers(); getViewSite().getActionBars().updateActionBars(); } }); @@ -851,6 +859,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis protected void createContextMenu(Control menuControl) { super.createContextMenu(menuControl); setAction(VARIABLES_COPY_ACTION, getAction(COPY_ACTION)); + setAction(VARIABLES_PASTE_ACTION, getAction(PASTE_ACTION)); } /** |