1 11 package org.eclipse.debug.internal.ui.actions.breakpointGroups; 12 13 import java.util.List ; 14 15 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 16 import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; 17 import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; 18 import org.eclipse.debug.internal.ui.views.breakpoints.OtherBreakpointCategory; 19 import org.eclipse.jface.viewers.IStructuredSelection; 20 import org.eclipse.ui.PlatformUI; 21 import org.eclipse.ui.views.navigator.LocalSelectionTransfer; 22 23 31 public class PasteBreakpointsAction extends BreakpointSelectionAction { 32 33 38 public PasteBreakpointsAction(BreakpointsView view) { 39 super(BreakpointGroupMessages.PasteBreakpointsAction_0, view); 40 setToolTipText(BreakpointGroupMessages.PasteBreakpointsAction_1); 41 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_BREAKPOINTS_ACTION); 42 } 43 44 50 private Object getTarget() { 51 List selectedNonResources = getSelectedNonResources(); 52 if (selectedNonResources.size() == 1) { 53 Object target = selectedNonResources.get(0); 54 if (target instanceof BreakpointContainer) { 55 return target; 56 } 57 } 58 return null; 59 } 60 61 64 public void run() { 65 if (getBreakpointsView().canPaste(getTarget(), LocalSelectionTransfer.getInstance().getSelection())) { 66 getBreakpointsView().performPaste(getTarget(), LocalSelectionTransfer.getInstance().getSelection()); 67 } 68 } 69 70 74 protected boolean updateSelection(IStructuredSelection selection) { 75 Object target = getTarget(); 77 if (target instanceof BreakpointContainer) { 78 BreakpointContainer container = (BreakpointContainer) target; 79 if (container.getCategory() instanceof OtherBreakpointCategory) { 80 return false; 81 } 82 return true; 83 } 84 return false; 86 } 87 } 88 | Popular Tags |