tree.addKeyListener(new KeyListener() {  public void keyPressed(KeyEvent arg0) {  }  public void keyReleased(KeyEvent e) {  }  public void keyTyped(KeyEvent e) { if(currentSelectedBugLeaf != null){ switch(e.getKeyChar()) { case '1': case '2': case '3': case '4': case '5': case '0': designationComboBox.setSelectedIndex(e.getKeyChar()-'0'); designationChanged=true; guiLayout.makeCommentsVisible(); break; } } } });
	private void setupTreeListeners()	{		tree.addTreeSelectionListener(new TreeSelectionListener(){			public void valueChanged(TreeSelectionEvent selectionEvent) {								TreePath path = selectionEvent.getNewLeadSelectionPath();								if (path != null)				{					saveCommentsToBug(currentSelectedBugLeaf);					if ((path.getLastPathComponent() instanceof BugLeafNode))					{							boolean beforeProjectChanged = projectChanged;						updateDesignation();						setUserCommentInputEnable(true);						BugLeafNode bugLeaf = (BugLeafNode)path.getLastPathComponent();						BugInstance bug = bugLeaf.getBug();						currentSelectedBugLeaf = bugLeaf;						currentSelectedBugAspects = null;						updateSummaryTab(bugLeaf);						updateCommentsTab(bugLeaf);						displayer.displaySource(bug, bug.getPrimarySourceLineAnnotation());						setProjectChanged(beforeProjectChanged);					}					else					{						updateDesignation();						currentSelectedBugLeaf = null;						currentSelectedBugAspects = (BugAspects)path.getLastPathComponent();						clearBottomTabs();					}				}//				Debug.println("Tree selection count:" + tree.getSelectionCount());				if (tree.getSelectionCount() !=1)				{					Debug.println("Tree selection count not equal to 1, disabling comments tab" + selectionEvent);									MainFrame.this.setUserCommentInputEnable(false);				}			}								});		tree.addKeyListener(new KeyListener() {			public void keyPressed(KeyEvent arg0) {							}			public void keyReleased(KeyEvent e) {							}						public void keyTyped(KeyEvent e) {				if(currentSelectedBugLeaf != null){					switch(e.getKeyChar())					{						case '1':						case '2':						case '3':						case '4':						case '5':						case '0':							designationComboBox.setSelectedIndex(e.getKeyChar()-'0');							designationChanged=true;							guiLayout.makeCommentsVisible();							break;					}				}			}		});				tree.addMouseListener(new MouseListener(){			public void mouseClicked(MouseEvent e) {				TreePath path = tree.getPathForLocation(e.getX(), e.getY());								if(path == null)					return;								if ((e.getButton() == MouseEvent.BUTTON3) || 						(e.getButton() == MouseEvent.BUTTON1 && e.isControlDown())){										if (tree.getModel().isLeaf(path.getLastPathComponent())){						tree.setSelectionPath(path);						bugPopupMenu.show(tree, e.getX(), e.getY());					}					else{						tree.setSelectionPath(path);						if (!(path.getParentPath()==null))//If the path's parent path is null, the root was selected, dont allow them to filter out the root.							branchPopupMenu.show(tree, e.getX(), e.getY());					}				}					}						public void mousePressed(MouseEvent arg0) {}			public void mouseReleased(MouseEvent arg0) {}			public void mouseEntered(MouseEvent arg0) {}			public void mouseExited(MouseEvent arg0) {}					});	}