private void openView(Object sourceObject) {
		JButton button = sourceObject instanceof JButton ? (JButton) sourceObject : null;
		final String[] treeNames = currentProgram.getListing().getTreeNames();
		popup = new JPopupMenu("Tree Views");
		for (int i = 0; i < treeNames.length; i++) {
			JMenuItem item = new JMenuItem(treeNames[i]);
			final int index = i;
			item.addActionListener(ev -> openView(treeNames[index]));
			popup.add(item);
		}

		if (treeNames.length == 0) {
			// should not get into this state...
			getTool().setStatusInfo("No views exist.");
		}
		else {
			popup.setBorder(new BevelBorder(BevelBorder.RAISED));
			if (button != null) {
				popup.show(button, button.getX() - button.getWidth(), button.getY());
			}
		}
	}
Method called when the "Open Tree View" icon is hit; creates a window
relative to the event source (in this case, a button) and shows the list
of trees currently in the Program.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java