|
59 | 59 | import com.sun.tools.visualvm.heapviewer.ui.HeapViewerNodeAction;
|
60 | 60 | import com.sun.tools.visualvm.heapviewer.ui.PluggableTreeTableView;
|
61 | 61 | import com.sun.tools.visualvm.heapviewer.ui.TreeTableViewColumn;
|
| 62 | +import javax.swing.AbstractAction; |
| 63 | +import javax.swing.JPopupMenu; |
| 64 | +import javax.swing.SwingUtilities; |
62 | 65 | import org.openide.util.NbBundle;
|
63 | 66 | import org.openide.util.lookup.ServiceProvider;
|
64 | 67 |
|
|
74 | 77 | "JavaThreadsView_TooltipObjects=Objects",
|
75 | 78 | "JavaThreadsView_TooltipHTML=HTML",
|
76 | 79 | "JavaThreadsView_Details=Details:",
|
77 |
| - "JavaThreadsView_SelectAction=Select in Threads" |
| 80 | + "JavaThreadsView_SelectAction=Select in Threads", |
| 81 | + "JavaThreadsView_ExpandAction=Expand All Threads", |
| 82 | + "JavaThreadsView_CollapseAction=Collapse All Threads" |
78 | 83 | })
|
79 | 84 | public class JavaThreadsView extends HeapViewerFeature {
|
80 | 85 |
|
@@ -112,6 +117,35 @@ protected void childrenChanged() {
|
112 | 117 | CCTNode[] children = getRoot().getChildren();
|
113 | 118 | for (CCTNode child : children) expandNode((HeapViewerNode)child);
|
114 | 119 | }
|
| 120 | + @Override |
| 121 | + protected void populatePopup(HeapViewerNode node, JPopupMenu popup) { |
| 122 | + if (popup.getComponentCount() > 0) popup.addSeparator(); |
| 123 | + |
| 124 | + popup.add(new AbstractAction(Bundle.JavaThreadsView_ExpandAction()) { |
| 125 | + @Override |
| 126 | + public void actionPerformed(ActionEvent e) { |
| 127 | + SwingUtilities.invokeLater(new Runnable() { |
| 128 | + @Override |
| 129 | + public void run() { |
| 130 | + CCTNode[] children = getRoot().getChildren(); |
| 131 | + for (CCTNode child : children) expandNode((HeapViewerNode)child); |
| 132 | + } |
| 133 | + }); |
| 134 | + } |
| 135 | + }); |
| 136 | + |
| 137 | + popup.add(new AbstractAction(Bundle.JavaThreadsView_CollapseAction()) { |
| 138 | + @Override |
| 139 | + public void actionPerformed(ActionEvent e) { |
| 140 | + SwingUtilities.invokeLater(new Runnable() { |
| 141 | + @Override |
| 142 | + public void run() { |
| 143 | + collapseChildren((HeapViewerNode)getRoot()); |
| 144 | + } |
| 145 | + }); |
| 146 | + } |
| 147 | + }); |
| 148 | + } |
115 | 149 | };
|
116 | 150 | objectsView.setViewName(Bundle.JavaThreadsView_Name());
|
117 | 151 |
|
|
0 commit comments