ToolWindowManager toolWindowManager = (ToolWindowManager) viewContext.get(ToolWindowManager.class);
JPanel toolsPanel = new JPanel(new TableLayout(new double[][]{{-1}, {-1}}));
toolsPanel.setBorder(new TitledBorder("ToolWindows"));
final JTable toolsTable = new JTable(new ToolsTableModel(toolWindowManager));
toolsTable.getTableHeader().setReorderingAllowed(false);
toolsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (toolsTable.getSelectedRow() != -1) {
ToolWindow selectedTool = (ToolWindow) toolsTable.getModel().getValueAt(toolsTable.getSelectedRow(), -1);