KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > editor > outline > FilterInternalTargetsAction


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.ant.internal.ui.editor.outline;
12
13 import org.eclipse.ant.internal.ui.AntUIImages;
14 import org.eclipse.ant.internal.ui.IAntUIConstants;
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.swt.custom.BusyIndicator;
17
18 /**
19  * An action which toggles filtering of internal targets from the Ant outline.
20  */

21 public class FilterInternalTargetsAction extends Action {
22     
23     private AntEditorContentOutlinePage fPage;
24     
25     public FilterInternalTargetsAction(AntEditorContentOutlinePage page) {
26         super(AntOutlineMessages.FilterInternalTargetsAction_0);
27         fPage = page;
28         setImageDescriptor(AntUIImages.getImageDescriptor(IAntUIConstants.IMG_FILTER_INTERNAL_TARGETS));
29         setToolTipText(AntOutlineMessages.FilterInternalTargetsAction_0);
30         setChecked(fPage.filterInternalTargets());
31     }
32     
33     /**
34      * Toggles the filtering of internal targets from the Ant outline
35      * @see org.eclipse.jface.action.IAction#run()
36      */

37     public void run() {
38         BusyIndicator.showWhile(fPage.getControl().getDisplay(), new Runnable JavaDoc() {
39             public void run() {
40                 fPage.setFilterInternalTargets(isChecked());
41             }
42         });
43     }
44 }
45
Popular Tags