-
Notifications
You must be signed in to change notification settings - Fork 82
/
CallHierarchyFiltersActionGroup.java
109 lines (90 loc) · 3.22 KB
/
CallHierarchyFiltersActionGroup.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*******************************************************************************
* Copyright (c) 2000, 2011 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation
* (report 36180: Callers/Callees view)
*******************************************************************************/
package org.eclipse.jdt.internal.ui.callhierarchy;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
/**
* Action group to add the filter actions to a view part's toolbar
* menu.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*/
public class CallHierarchyFiltersActionGroup extends ActionGroup {
class ShowFilterDialogAction extends Action {
ShowFilterDialogAction() {
setText(CallHierarchyMessages.ShowFilterDialogAction_text);
setImageDescriptor(JavaPluginImages.DESC_ELCL_FILTER);
setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_FILTER);
}
@Override
public void run() {
openFiltersDialog();
}
}
class ShowExpandWithConstructorsDialogAction extends Action {
ShowExpandWithConstructorsDialogAction() {
setText(CallHierarchyMessages.ShowExpandWithConstructorsDialogAction_text);
}
@Override
public void run() {
openExpandWithConstructorsDialog();
}
}
private CallHierarchyViewPart fPart;
/**
* Creates a new <code>CustomFiltersActionGroup</code>.
*
* @param part the call hierarchy view part
* @param viewer the call hierarchy viewer
*/
public CallHierarchyFiltersActionGroup(CallHierarchyViewPart part, CallHierarchyViewer viewer) {
Assert.isNotNull(part);
Assert.isNotNull(viewer);
fPart= part;
}
@Override
public void fillActionBars(IActionBars actionBars) {
fillViewMenu(actionBars.getMenuManager());
}
private void fillViewMenu(IMenuManager viewMenu) {
viewMenu.add(new Separator("filters")); //$NON-NLS-1$
viewMenu.add(new ShowFilterDialogAction());
viewMenu.add(new ShowExpandWithConstructorsDialogAction());
}
@Override
public void dispose() {
super.dispose();
}
// ---------- dialog related code ----------
private void openFiltersDialog() {
FiltersDialog dialog= new FiltersDialog(
fPart.getViewSite().getShell());
if(Window.OK == dialog.open()) {
fPart.refresh();
}
}
private void openExpandWithConstructorsDialog() {
Shell parentShell= fPart.getViewSite().getShell();
new ExpandWithConstructorsDialog(parentShell).open();
}
}