KickJava   Java API By Example, From Geeks To Geeks.

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


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.debug.internal.ui.views.breakpoints.BreakpointsView;
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.ui.IViewActionDelegate;
17 import org.eclipse.ui.IViewPart;
18
19 /**
20  * An action which toggles the "Link with Debug View" preference on a
21  * breakpoints view.
22  */

23 public class LinkBreakpointsWithDebugViewAction implements IViewActionDelegate {
24     
25     private BreakpointsView fView;
26     private IAction fAction= null;
27     
28     public LinkBreakpointsWithDebugViewAction() {
29     }
30
31     /* (non-Javadoc)
32      * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
33      */

34     public void init(IViewPart view) {
35         fView= (BreakpointsView) view;
36     }
37
38     /* (non-Javadoc)
39      * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
40      */

41     public void run(IAction action) {
42         fView.setTrackSelection(action.isChecked());
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
47      */

48     public void selectionChanged(IAction action, ISelection selection) {
49         if (fAction == null) {
50             action.setChecked(fView.isTrackingSelection());
51             fAction= action;
52         }
53     }
54
55 }
56
Popular Tags