deboer | 65ea507 | 2005-02-17 19:14:45 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2003, 2005 IBM Corporation and others. |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 3 | * All rights reserved. This program and the accompanying materials |
deboer | df10c15 | 2005-02-17 18:24:46 +0000 | [diff] [blame] | 4 | * are made available under the terms of the Eclipse Public License v1.0 |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 5 | * which accompanies this distribution, and is available at |
deboer | df10c15 | 2005-02-17 18:24:46 +0000 | [diff] [blame] | 6 | * http://www.eclipse.org/legal/epl-v10.html |
deboer | 65ea507 | 2005-02-17 19:14:45 +0000 | [diff] [blame] | 7 | * |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 8 | * Contributors: |
deboer | f942357 | 2005-02-17 19:34:29 +0000 | [diff] [blame] | 9 | * IBM Corporation - Initial API and implementation |
deboer | 65ea507 | 2005-02-17 19:14:45 +0000 | [diff] [blame] | 10 | *******************************************************************************/ |
deboer | 03d3897 | 2004-12-06 22:29:45 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.internet.monitor.ui.internal.view; |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 12 | |
| 13 | import org.eclipse.jface.action.Action; |
| 14 | import org.eclipse.jface.action.IAction; |
deboer | e8f7e3c | 2005-03-08 16:21:51 +0000 | [diff] [blame] | 15 | import org.eclipse.wst.internet.monitor.core.internal.IContentFilter; |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 16 | /** |
| 17 | * |
| 18 | */ |
| 19 | public class FilterAction extends Action { |
deboer | 28e8098 | 2005-05-31 14:14:37 +0000 | [diff] [blame] | 20 | protected ViewerManager vm; |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 21 | protected IContentFilter filter; |
| 22 | protected boolean enabled; |
| 23 | |
deboer | 28e8098 | 2005-05-31 14:14:37 +0000 | [diff] [blame] | 24 | public FilterAction(ViewerManager vm, IContentFilter filter) { |
deboer | fbd35ee | 2004-12-06 22:18:24 +0000 | [diff] [blame] | 25 | super(filter.getName(), IAction.AS_CHECK_BOX); |
| 26 | this.vm = vm; |
| 27 | this.filter = filter; |
| 28 | } |
| 29 | |
| 30 | public void run() { |
| 31 | if (!isChecked()) |
| 32 | vm.removeFilter(filter); |
| 33 | else |
| 34 | vm.addFilter(filter); |
| 35 | } |
| 36 | } |