KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > ui > coverageview > LinkWithSelectionAction


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: LinkWithSelectionAction.java 393 2007-08-28 13:05:34Z mtnminds $
7  *
8  * Contributors:
9  * Brock Janiczak - link with selection option (SF #1774547)
10  ******************************************************************************/

11 package com.mountainminds.eclemma.internal.ui.coverageview;
12
13 import org.eclipse.jface.action.Action;
14
15 import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin;
16 import com.mountainminds.eclemma.internal.ui.UIMessages;
17
18 /**
19  * Action to enable linking of the coverage view's selection with the current
20  * selection in the workbench. Internally used by the coverage view.
21  *
22  * @author Marc R. Hoffmann
23  * @version $Revision: 393 $
24  */

25 class LinkWithSelectionAction extends Action {
26
27   private final ViewSettings settings;
28   private final SelectionTracker tracker;
29   
30   LinkWithSelectionAction(ViewSettings settings, SelectionTracker tracker) {
31     super(UIMessages.CoverageViewLinkWithSelectionAction_label, AS_CHECK_BOX);
32     setToolTipText(UIMessages.CoverageViewLinkWithSelectionAction_tooltip);
33     setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_LINKED));
34     this.settings = settings;
35     this.tracker = tracker;
36     setChecked(settings.getLinked());
37   }
38
39   public void run() {
40     boolean flag = isChecked();
41     settings.setLinked(flag);
42     tracker.setEnabled(flag);
43   }
44
45 }
46
Popular Tags