KickJava   Java API By Example, From Geeks To Geeks.

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


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.views.breakpoints.BreakpointsView;
14 import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer;
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.jface.action.IAction;
17
18 /**
19  * An action which sets the breakpoint factory on a breakpoint view,
20  * effectively telling the view to group breakpoints according to
21  * some criteria (as determined by the factory).
22  */

23 public class GroupBreakpointsAction extends Action {
24     
25     private IBreakpointOrganizer fOrganzier;
26     private BreakpointsView fView;
27
28     /**
29      * Creates a new action which will group breakpoints in the given
30      * breakpoint view using the given breakpoint container factory
31      * @param factory the factory that will be applied to the given view
32      * when this action is run
33      * @param view the breakpoints view
34      */

35     public GroupBreakpointsAction(IBreakpointOrganizer organizer, BreakpointsView view) {
36         super("", IAction.AS_RADIO_BUTTON); //$NON-NLS-1$
37
fOrganzier= organizer;
38         fView= view;
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.jface.action.IAction#run()
43      */

44     public void run() {
45         if (isChecked()) {
46             if (fOrganzier == null) {
47                 fView.setBreakpointOrganizers(null);
48             } else {
49                 fView.setBreakpointOrganizers(new IBreakpointOrganizer[]{fOrganzier});
50             }
51         }
52     }
53     
54     /**
55      * Returns this action's organizer.
56      *
57      * @return breakpoint organizer
58      */

59     public IBreakpointOrganizer getOrganizer() {
60         return fOrganzier;
61     }
62 }
63
Popular Tags