public void run() {
updateUserCount();
getWho().removeAll();
Channel chan = c.getCChannel().getChannel();
Comparator<User> nickOrder = new Comparator<User>() {
@Override
public int compare(User u1, User u2) {
;
return u1.getNick().compareTo(u2.getNick());
}
};
if (chan.getOwners().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Owners");
List<User> users = new LinkedList<User>(chan.getOwners());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());
i.getTree().setText(u.getNick());
}
t.setExpanded(true);
}
if (chan.getSuperOps().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Super-Ops");
List<User> users = new LinkedList<User>(chan.getSuperOps());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());
i.getTree().setText(u.getNick());
}
t.setExpanded(true);
}
if (chan.getOps().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Ops");
List<User> users = new LinkedList<User>(chan.getOps());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());
i.getTree().setText(u.getNick());
}
t.setExpanded(true);
}
if (chan.getHalfOps().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Half-Ops");
List<User> users = new LinkedList<User>(chan.getHalfOps());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());
i.getTree().setText(u.getNick());
}
t.setExpanded(true);
}
if (chan.getVoices().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Voices");
List<User> users = new LinkedList<User>(chan.getVoices());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());
i.getTree().setText(u.getNick());
}
t.setExpanded(true);
}
if (chan.getNormalUsers().size() > 0) {
TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
t.setText("Normal");
List<User> users = new LinkedList<User>(chan
.getNormalUsers());
Collections.sort(users, nickOrder);
for (User u : users) {
UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
.getCChannel());