KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > typehierarchy > SortByDefiningTypeAction


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.jdt.internal.ui.typehierarchy;
12
13 import org.eclipse.swt.custom.BusyIndicator;
14
15 import org.eclipse.jface.action.Action;
16
17 import org.eclipse.ui.PlatformUI;
18
19 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
20 import org.eclipse.jdt.internal.ui.JavaPluginImages;
21
22 /**
23  * Action to let the label provider show the defining type of the method
24  */

25 public class SortByDefiningTypeAction extends Action {
26     
27     private MethodsViewer fMethodsViewer;
28     
29     /**
30      * Creates the action.
31      */

32     public SortByDefiningTypeAction(MethodsViewer viewer, boolean initValue) {
33         super(TypeHierarchyMessages.SortByDefiningTypeAction_label);
34         setDescription(TypeHierarchyMessages.SortByDefiningTypeAction_description);
35         setToolTipText(TypeHierarchyMessages.SortByDefiningTypeAction_tooltip);
36         
37         JavaPluginImages.setLocalImageDescriptors(this, "definingtype_sort_co.gif"); //$NON-NLS-1$
38

39         fMethodsViewer= viewer;
40         
41         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SORT_BY_DEFINING_TYPE_ACTION);
42  
43         setChecked(initValue);
44     }
45     
46     /*
47      * @see Action#actionPerformed
48      */

49     public void run() {
50         BusyIndicator.showWhile(fMethodsViewer.getControl().getDisplay(), new Runnable JavaDoc() {
51             public void run() {
52                 fMethodsViewer.sortByDefiningType(isChecked());
53             }
54         });
55     }
56 }
57
Popular Tags