private JPopupMenu createTablePopup() {
    JPopupMenu popup = new JPopupMenu();

    showInstanceItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_ShowInstanceItemText());
    showInstanceItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            performDefaultAction();
          }
        });
    showInstanceItem.setFont(popup.getFont().deriveFont(Font.BOLD));

    //        showClassItem = new JMenuItem(SHOW_IN_CLASSES_ITEM_TEXT);
    //        showClassItem.addActionListener(new ActionListener() {
    //                public void actionPerformed(ActionEvent e) {
    //                    int row = fieldsListTable.getSelectedRow();
    //
    //                    if (row != -1) {
    //                        HeapWalkerNode node = (HeapWalkerNode)
    // fieldsListTable.getTree().getPathForRow(row).getLastPathComponent();
    //
    //                        if (node instanceof HeapWalkerInstanceNode) {
    //                            HeapWalkerInstanceNode instanceNode = (HeapWalkerInstanceNode)
    // node;
    //
    //                            if (instanceNode instanceof ObjectFieldNode && ((ObjectFieldNode)
    // instanceNode).isStatic()) {
    //                                referencesBrowserController.navigateToClass(((ObjectFieldNode)
    // instanceNode).getFieldValue()
    //
    // .getField().getDeclaringClass());
    //                            } else if (instanceNode.hasInstance()) {
    //
    // referencesBrowserController.navigateToClass(instanceNode.getInstance().getJavaClass());
    //                            }
    //                        }
    //                    }
    //                }
    //            });

    showGcRootItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_ShowGcRootItemText());
    showGcRootItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = fieldsListTable.getSelectedRow();

            if (row != -1) {
              HeapWalkerNode node =
                  (HeapWalkerNode)
                      fieldsListTable.getTree().getPathForRow(row).getLastPathComponent();

              if (node instanceof InstanceNode) {
                InstanceNode instanceNode = (InstanceNode) node;

                if (instanceNode.hasInstance()) {
                  referencesBrowserController.navigateToNearestGCRoot(instanceNode);
                }
              }
            }
          }
        });

    showLoopOriginItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_ShowLoopItemText());
    showLoopOriginItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = fieldsListTable.getSelectedRow();

            if (row != -1) {
              HeapWalkerNode node =
                  (HeapWalkerNode)
                      fieldsListTable.getTree().getPathForRow(row).getLastPathComponent();

              if (node instanceof HeapWalkerInstanceNode
                  && ((HeapWalkerInstanceNode) node).isLoop()) {
                selectNode(((HeapWalkerInstanceNode) node).getLoopTo());
              }
            }
          }
        });

    // Copy Path From Root
    copyPathFromRootItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_CopyPathFromRoot());
    copyPathFromRootItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = fieldsListTable.getSelectedRow();
            if (row != -1) {
              TreePath path = fieldsListTable.getTree().getPathForRow(row);
              BrowserUtils.copyPathFromRoot(path);
            }
          };
        });

    if (GoToSource.isAvailable()) {
      showSourceItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_GoToSourceItemText());
      showSourceItem.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              int row = fieldsListTable.getSelectedRow();

              if (row != -1) {
                HeapWalkerNode node =
                    (HeapWalkerNode)
                        fieldsListTable.getTree().getPathForRow(row).getLastPathComponent();
                String className = node.getType();

                while (className.endsWith("[]")) {
                  className = className.substring(0, className.length() - 2); // NOI18N
                }
                Lookup.Provider p =
                    referencesBrowserController
                        .getReferencesControllerHandler()
                        .getHeapFragmentWalker()
                        .getHeapDumpProject();
                GoToSource.openSource(p, className, null, null);
              }
            }
          });
    }

    showInThreadsItem = new JMenuItem(Bundle.ReferencesBrowserControllerUI_ShowInThreadsItemText());
    showInThreadsItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = fieldsListTable.getSelectedRow();

            if (row != -1) {
              HeapWalkerNode node =
                  (HeapWalkerNode)
                      fieldsListTable.getTree().getPathForRow(row).getLastPathComponent();
              if (node instanceof HeapWalkerInstanceNode) {
                Instance instance = ((HeapWalkerInstanceNode) node).getInstance();
                referencesBrowserController.showInThreads(instance);
              }
            }
          }
        });

    popup.add(showInstanceItem);
    //        popup.add(showClassItem);
    popup.add(showGcRootItem);
    popup.add(showInThreadsItem);
    popup.addSeparator();
    popup.add(copyPathFromRootItem);
    popup.addSeparator();
    popup.add(showLoopOriginItem);
    if (showSourceItem != null) popup.add(showSourceItem);

    return popup;
  }