KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > breakpointGroups > BreakpointWorkingSetAction


1 /*******************************************************************************
2  * Copyright (c) 2004, 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 implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.actions.breakpointGroups;
12
13 import org.eclipse.debug.internal.ui.DebugUIPlugin;
14 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
15 import org.eclipse.jface.action.IAction;
16 import org.eclipse.jface.util.IPropertyChangeListener;
17 import org.eclipse.jface.util.PropertyChangeEvent;
18 import org.eclipse.jface.viewers.ISelection;
19 import org.eclipse.ui.IViewPart;
20
21 /**
22  * An action which clears (sets the null) the default breakpoint group.
23  * @see org.eclipse.debug.core.IBreakpointManager#setAutoGroup(String)
24  */

25 public abstract class BreakpointWorkingSetAction extends AbstractBreakpointsViewAction implements IPropertyChangeListener {
26     
27     protected IAction fAction;
28
29     /* (non-Javadoc)
30      * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
31      */

32     public void selectionChanged(IAction action, ISelection selection) {
33         update();
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
38      */

39     public void init(IViewPart view) {
40         super.init(view);
41         DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
42     }
43     
44     /* (non-Javadoc)
45      * @see org.eclipse.ui.IActionDelegate2#dispose()
46      */

47     public void dispose() {
48         DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
49         super.dispose();
50     }
51     /* (non-Javadoc)
52      * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
53      */

54     public void init(IAction action) {
55         fAction = action;
56         super.init(action);
57         update();
58     }
59     
60     /* (non-Javadoc)
61      * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
62      */

63     public void propertyChange(PropertyChangeEvent event) {
64         if (event.getProperty().equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
65             update();
66         }
67
68     }
69     protected abstract void update();
70 }
71
Popular Tags