]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/typehierarchy/ShowInheritedMembersAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / typehierarchy / ShowInheritedMembersAction.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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 show / hide inherited members in the method view
24  * Depending in the action state a different label provider is installed in the viewer
25  */
26 public class ShowInheritedMembersAction extends Action {
27
28         private MethodsViewer fMethodsViewer;
29
30         /**
31          * Creates the action.
32          * @param viewer the viewer
33          * @param initValue the initial state
34          */
35         public ShowInheritedMembersAction(MethodsViewer viewer, boolean initValue) {
36                 super(TypeHierarchyMessages.ShowInheritedMembersAction_label);
37                 setDescription(TypeHierarchyMessages.ShowInheritedMembersAction_description);
38                 setToolTipText(TypeHierarchyMessages.ShowInheritedMembersAction_tooltip);
39
40                 JavaPluginImages.setLocalImageDescriptors(this, "inher_co.gif"); //$NON-NLS-1$
41
42                 fMethodsViewer= viewer;
43
44                 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.SHOW_INHERITED_ACTION);
45
46                 setChecked(initValue);
47         }
48
49         /*
50          * @see Action#actionPerformed
51          */
52         @Override
53         public void run() {
54                 BusyIndicator.showWhile(fMethodsViewer.getControl().getDisplay(), new Runnable() {
55                         public void run() {
56                                 fMethodsViewer.showInheritedMethods(isChecked());
57                         }
58                 });
59         }
60 }