KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > markers > internal > FilterEnablementAction


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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.ui.views.markers.internal;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.swt.SWT;
15
16 /**
17  * The FilterEnablementAction is an action for enabling
18  * or disabling a filter.
19  *
20  */

21 class FilterEnablementAction extends Action {
22
23     private MarkerFilter markerFilter;
24     private MarkerView markerView;
25
26     /**
27      * Create a new action for the filter.
28      * @param filter
29      * @param view
30      */

31     public FilterEnablementAction(MarkerFilter filter, MarkerView view) {
32         super(filter.getName(),SWT.CHECK);
33         setChecked(filter.isEnabled());
34         markerFilter = filter;
35         markerView = view;
36         
37     }
38     
39     /* (non-Javadoc)
40      * @see org.eclipse.jface.action.IAction#run()
41      */

42     public void run() {
43         markerFilter.setEnabled(!markerFilter.isEnabled());
44         setChecked(markerFilter.isEnabled());
45         markerView.updateForFilterChanges();
46     }
47
48
49 }
50
Popular Tags