19 package org.sleuthkit.autopsy.directorytree;
21 import java.awt.event.ActionEvent;
22 import javax.swing.AbstractAction;
23 import javax.swing.JMenu;
24 import javax.swing.JMenuItem;
25 import org.openide.nodes.Node;
26 import org.openide.util.NbBundle;
27 import org.openide.util.actions.Presenter;
37 class ChangeViewAction
extends AbstractAction implements Presenter.Popup {
45 public ChangeViewAction(String title,
int viewType, Node node) {
60 public void actionPerformed(ActionEvent e) {
61 DataContentTopComponent dctc = DataContentTopComponent.findInstance();
62 int totalTabs = dctc.getTabPanels().getTabCount();
70 for (
int i = 0; i < totalTabs; i++) {
71 if (dctc.getTabPanels().getComponentAt(i) instanceof DataContentViewerHex) {
72 dctc.getTabPanels().setSelectedIndex(i);
82 for (
int i = 0; i < totalTabs; i++) {
83 if (dctc.getTabPanels().getComponentAt(i) instanceof DataContentViewerString) {
84 dctc.getTabPanels().setSelectedIndex(i);
97 public JMenuItem getPopupPresenter() {
98 JMenu item =
new JMenu(NbBundle.getMessage(
this.getClass(),
"ChangeViewAction.menuItem.view"));
99 item.add(
new ChangeViewAction(NbBundle.getMessage(
this.getClass(),
"ChangeViewAction.menuItem.view.hex"), 1, node));
100 item.add(
new ChangeViewAction(NbBundle.getMessage(
this.getClass(),
"ChangeViewAction.menuItem.view.string"), 2, node));