KickJava   Java API By Example, From Geeks To Geeks.

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


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
17 /**
18  * An action which toggles sorting in the Ant outline page.
19  */

20 public class ToggleSortAntOutlineAction extends Action {
21
22     private AntEditorContentOutlinePage fPage;
23     
24     public ToggleSortAntOutlineAction(AntEditorContentOutlinePage page) {
25         super(AntOutlineMessages.ToggleSortAntOutlineAction_0);
26         fPage = page;
27         setImageDescriptor(AntUIImages.getImageDescriptor(IAntUIConstants.IMG_SORT_OUTLINE));
28         setToolTipText(AntOutlineMessages.ToggleSortAntOutlineAction_0);
29         setChecked(fPage.isSort());
30     }
31     
32     /**
33      * Toggles the sorting of targets in the Ant outline
34      * @see org.eclipse.jface.action.IAction#run()
35      */

36     public void run() {
37         fPage.setSort(isChecked());
38     }
39     
40 }
41
Popular Tags