KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > breakpoints > RetargetToggleBreakpointAction


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.actions.breakpoints;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
15 import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
16 import org.eclipse.jface.viewers.ISelection;
17 import org.eclipse.ui.IWorkbenchPart;
18
19
20 /**
21  * Global retargettable toggle breakpoint action.
22  *
23  * @since 3.3
24  */

25 public class RetargetToggleBreakpointAction extends RetargetBreakpointAction {
26     
27     /* (non-Javadoc)
28      * @see org.eclipse.debug.internal.ui.actions.RetargetBreakpointAction#performAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
29      */

30     protected void performAction(Object JavaDoc target, ISelection selection, IWorkbenchPart part) throws CoreException {
31         if (target instanceof IToggleBreakpointsTargetExtension) {
32             IToggleBreakpointsTargetExtension ext = (IToggleBreakpointsTargetExtension) target;
33             ext.toggleBreakpoints(part, selection);
34         } else {
35             ((IToggleBreakpointsTarget)target).toggleLineBreakpoints(part, selection);
36         }
37     }
38     /* (non-Javadoc)
39      * @see org.eclipse.debug.internal.ui.actions.RetargetBreakpointAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
40      */

41     protected boolean canPerformAction(Object JavaDoc target, ISelection selection, IWorkbenchPart part) {
42         if (target instanceof IToggleBreakpointsTargetExtension) {
43             IToggleBreakpointsTargetExtension ext = (IToggleBreakpointsTargetExtension) target;
44             return ext.canToggleBreakpoints(part, selection);
45         } else {
46             return ((IToggleBreakpointsTarget)target).canToggleLineBreakpoints(part, selection);
47         }
48     }
49     /* (non-Javadoc)
50      * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getOperationUnavailableMessage()
51      */

52     protected String JavaDoc getOperationUnavailableMessage() {
53         return Messages.RetargetToggleBreakpointAction_0;
54     }
55 }
56
Popular Tags