if (paths == null) return;
    void onClick(boolean popupTrigger)    {        Object pathComponent;        TreePath[] paths = view.getTreeDisplay().getSelectionPaths();        int n = paths.length;        if (n == 0) return;        pathComponent = paths[0].getLastPathComponent();        //Check if alls node are of the same type.        if (!(pathComponent instanceof TreeImageDisplay)) return;        TreeImageDisplay node = (TreeImageDisplay) pathComponent;        TreeImageDisplay no;        Object o;        ArrayList l = new ArrayList();        l.add(node);        for (int i = 1; i < n; i++) {            o = paths[i].getLastPathComponent();            if (o instanceof TreeImageDisplay) {                no = (TreeImageDisplay) o;                if (no.getUserObject().getClass().equals(                        node.getUserObject().getClass())) {                    l.add(no);                }            }        }        if (l.size() != n) {            UserNotifier un =                 TreeViewerAgent.getRegistry().getUserNotifier();            un.notifyInfo("Node selection", "You can only select " +                    "node of the same type e.g. images.");            return;        }        //Pass TreeImageDisplay array        TreeImageDisplay[] nodes = (TreeImageDisplay[]) l.toArray(                                    new TreeImageDisplay[l.size()]);        model.setSelectedDisplays(nodes);        if (popupTrigger) model.showPopupMenu();    }