KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > ModificationWatchpointToggleAction


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.debug.internal.ui.actions;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.core.model.IWatchpoint;
15
16 /**
17  * Toggles access attribute of a watchpoint.
18  */

19 public class ModificationWatchpointToggleAction extends ModifyWatchpointAction {
20
21     /* (non-Javadoc)
22      * @see org.eclipse.debug.internal.ui.actions.ModifyWatchpointAction#isEnabled(org.eclipse.debug.core.model.IWatchpoint)
23      */

24     protected boolean isEnabled(IWatchpoint watchpoint) {
25         return watchpoint.supportsModification();
26     }
27
28     /* (non-Javadoc)
29      * @see org.eclipse.debug.internal.ui.actions.ModifyWatchpointAction#toggleWatchpoint(org.eclipse.debug.core.model.IWatchpoint, boolean)
30      */

31     protected void toggleWatchpoint(IWatchpoint watchpoint, boolean b) throws CoreException {
32         watchpoint.setModification(b);
33     }
34
35     /* (non-Javadoc)
36      * @see org.eclipse.debug.internal.ui.actions.ModifyWatchpointAction#isChecked(org.eclipse.debug.core.model.IWatchpoint)
37      */

38     protected boolean isChecked(IWatchpoint watchpoint) {
39         try {
40             return watchpoint.isModification();
41         } catch (CoreException e) {
42         }
43         return false;
44     }
45
46 }
47
Popular Tags