Source:
<code>private JTree getTreeContext() { if (treeContext == null) { reloadContextTree(); treeContext = new JTree(this.contextTree); treeContext.setShowsRootHandles(true); treeContext.setName(CONTEXT_TREE_COMPONENT_NAME); treeContext.setToggleClickCount(1); treeContext .getSelectionModel() .setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); treeContext.addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent e) @Override public void mouseReleased(java.awt.event.MouseEvent e) { mouseClicked(e); } @Override public void mouseClicked(java.awt.event.MouseEvent e) { TreePath path = treeContext.getClosestPathForLocation(e.getX(), e.getY()); if (path != null) { if (((SiteNode) path.getLastPathComponent()).isRoot()) { treeContext.removeSelectionPath(path); } } if (e.getClickCount() > 1) { SiteNode node = (SiteNode) treeContext.getLastSelectedPathComponent(); if (node != null && node.getUserObject() != null) { Target target = (Target) node.getUserObject(); String panelName = ContextGeneralPanel.getPanelName(target.getContext()); getView().getSessionDialog().expandParamPanelNode(panelName); if (getView() .getSessionDialog() .isParamPanelOrChildSelected(panelName)) { panelName = null; } getView() .showSessionDialog( Model.getSingleton().getSession(), panelName); } } } }); treeContext.setComponentPopupMenu(new ContextsCustomPopupMenu()); treeContext.setCellRenderer(new ContextsTreeCellRenderer()); DeleteContextAction delContextAction = new DeleteContextAction() { private static final long serialVersionUID = 1L; @Override <START> protected ArrayList<Context> getContexts() { <END> return new ArrayList<Context>(getSelectedContexts()); } @Override protected Context getContext() { return getSelectedContext(); } }; treeContext .getInputMap() .put( (KeyStroke) delContextAction.getValue(DeleteContextAction.ACCELERATOR_KEY), DeleteContextAction.ACTION_NAME); treeContext.getActionMap().put(DeleteContextAction.ACTION_NAME, delContextAction); } return treeContext; }</code><technical_language>List<Context>, for consistency</technical_language>

Target:
private JTree getTreeContext() { if (treeContext == null) { reloadContextTree(); treeContext = new JTree(this.contextTree); treeContext.setShowsRootHandles(true); treeContext.setName(CONTEXT_TREE_COMPONENT_NAME); treeContext.setToggleClickCount(1); treeContext .getSelectionModel() .setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); treeContext.addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent e) @Override public void mouseReleased(java.awt.event.MouseEvent e) { mouseClicked(e); } @Override public void mouseClicked(java.awt.event.MouseEvent e) { TreePath path = treeContext.getClosestPathForLocation(e.getX(), e.getY()); if (treeSite.getLastSelectedPathComponent() != null) { getTreeSite().clearSelection(); } if (path != null) { if (((SiteNode) path.getLastPathComponent()).isRoot()) { treeContext.removeSelectionPath(path); } } if (e.getClickCount() > 1) { SiteNode node = (SiteNode) treeContext.getLastSelectedPathComponent(); if (node != null && node.getUserObject() != null) { Target target = (Target) node.getUserObject(); String panelName = ContextGeneralPanel.getPanelName(target.getContext()); getView().getSessionDialog().expandParamPanelNode(panelName); if (getView() .getSessionDialog() .isParamPanelOrChildSelected(panelName)) { panelName = null; } getView() .showSessionDialog( Model.getSingleton().getSession(), panelName); } } } }); treeContext.setComponentPopupMenu(new ContextsCustomPopupMenu()); treeContext.setCellRenderer(new ContextsTreeCellRenderer()); DeleteContextAction delContextAction = new DeleteContextAction() { private static final long serialVersionUID = 1L; @Override protected List<Context> getContexts() { return getSelectedContexts(); } @Override protected Context getContext() { return getSelectedContext(); } }; treeContext .getInputMap() .put( (KeyStroke) delContextAction.getValue(DeleteContextAction.ACCELERATOR_KEY), DeleteContextAction.ACTION_NAME); treeContext.getActionMap().put(DeleteContextAction.ACTION_NAME, delContextAction); } return treeContext; }