KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > ExitToggleAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.debug.ui.actions;
12
13  
14 import java.util.Iterator JavaDoc;
15
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.jdt.debug.core.IJavaBreakpoint;
18 import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
19 import org.eclipse.jface.viewers.IStructuredSelection;
20
21 public class ExitToggleAction extends BreakpointToggleAction {
22
23     /**
24      * @see BreakpointToggleAction#getToggleState(IJavaBreakpoint)
25      */

26     protected boolean getToggleState(IJavaBreakpoint breakpoint) throws CoreException {
27         return ((IJavaMethodBreakpoint)breakpoint).isExit();
28     }
29
30     /**
31      * @see BreakpointToggleAction#doAction(IJavaBreakpoint)
32      */

33     public void doAction(IJavaBreakpoint breakpoint) throws CoreException {
34         ((IJavaMethodBreakpoint)breakpoint).setExit(!((IJavaMethodBreakpoint)breakpoint).isExit());
35     }
36
37     /**
38      * @see BreakpointToggleAction#isEnabledFor(IStructuredSelection)
39      */

40     public boolean isEnabledFor(IStructuredSelection selection) {
41         Iterator JavaDoc iter= selection.iterator();
42         while (iter.hasNext()) {
43             Object JavaDoc element = iter.next();
44             if (!(element instanceof IJavaMethodBreakpoint)) {
45                 return false;
46             }
47             
48         }
49         return true;
50     }
51 }
52
53
Popular Tags