} else if (groupBy == GROUP_BY_BUG_CATEGORY) { groupName = I18N.instance().getBugCategoryDescription(member.getBugPattern().getCategory());
	private void populateAnalysisRunTreeModel(AnalysisRun analysisRun, final String groupBy) {		//System.out.println("Populating bug tree for order " + groupBy);				// Set busy cursor - this is potentially a time-consuming operation		Cursor orig = this.getCursor();		this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));				final DefaultTreeModel bugTreeModel = analysisRun.getTreeModel(groupBy);		final DefaultMutableTreeNode bugRootNode = (DefaultMutableTreeNode) bugTreeModel.getRoot();				// Delete all children from root node		bugRootNode.removeAllChildren();				// Sort the instances (considering only those that meet the		// priority threshold)		TreeSet<BugInstance> sortedCollection = new TreeSet<BugInstance>(getBugInstanceComparator(groupBy));		for (Iterator<BugInstance> i = analysisRun.getBugInstances().iterator(); i.hasNext();) {			BugInstance bugInstance = i.next();			if (getFilterSettings().displayWarning(bugInstance))				sortedCollection.add(bugInstance);		}				// The grouper callback is what actually adds the group and bug		// nodes to the tree.		Grouper.Callback<BugInstance> callback = new Grouper.Callback<BugInstance>() {			private BugInstanceGroup currentGroup;			private DefaultMutableTreeNode currentGroupNode;						public void startGroup(BugInstance member) {				String groupName;				if (groupBy == GROUP_BY_CLASS)					groupName = member.getPrimaryClass().getClassName();				else if (groupBy == GROUP_BY_PACKAGE) {					groupName = member.getPrimaryClass().getPackageName();					if (groupName.equals(""))						groupName = "Unnamed package";				} else if (groupBy == GROUP_BY_BUG_TYPE) {					String desc = member.toString();					String shortBugType = desc.substring(0, desc.indexOf(':'));					String bugTypeDescription = I18N.instance().getBugTypeDescription(shortBugType);					groupName = shortBugType + ": " + bugTypeDescription;				} else					throw new IllegalStateException("Unknown sort order: " + groupBy);				currentGroup = new BugInstanceGroup(groupBy, groupName);				currentGroupNode = new DefaultMutableTreeNode(currentGroup);				bugTreeModel.insertNodeInto(currentGroupNode, bugRootNode, bugRootNode.getChildCount());								insertIntoGroup(member);			}						public void addToGroup(BugInstance member) {				insertIntoGroup(member);			}						private void insertIntoGroup(BugInstance member) {				int count = currentGroup.getMemberCount();				currentGroup.incrementMemberCount();				BugTreeNode bugNode = new BugTreeNode(member);				if (BUG_COUNT)					bugNode.setCount(count);				bugTreeModel.insertNodeInto(bugNode, currentGroupNode, currentGroupNode.getChildCount());								// Insert annotations				Iterator j = member.annotationIterator();				while (j.hasNext()) {					BugAnnotation annotation = (BugAnnotation) j.next();					DefaultMutableTreeNode annotationNode = new DefaultMutableTreeNode(annotation);					bugTreeModel.insertNodeInto(annotationNode, bugNode, bugNode.getChildCount());				}							}		};				// Create the grouper, and execute it to populate the bug tree		Grouper<BugInstance> grouper = new Grouper<BugInstance>(callback);		Comparator<BugInstance> groupComparator = getGroupComparator(groupBy);		grouper.group(sortedCollection, groupComparator);				// Let the tree know it needs to update itself		bugTreeModel.nodeStructureChanged(bugRootNode);				// Now we're done		this.setCursor(orig);	}