if (model.getTreeView() != null) {
TreeView tv = model.getTreeView(); if (tv != null) {
    public void setHierarchyRoots(Set roots, boolean flat, boolean refresh)    {        if (model.getState() != LOADING_HIERARCHY)            throw new IllegalStateException(                    "This method can only be invoked in the LOADING_HIERARCHY "+                    "state.");        if (!refresh) {        	model.createBrowser(roots, flat);            model.createClipBoard();            model.getClipBoard().addPropertyChangeListener(controller);            model.fireThumbnailLoading();            //b/c fireThumbnailLoading() sets the state to READY if there is no            //image.            if (model.getBrowser().getImages().size() == 0)             	setStatus("Done", -1);            else setStatus(HiViewer.PAINTING_TEXT, -1);            fireStateChange();        } else {        	Browser browser = model.getBrowser();        	boolean isClipBoardDisplay = model.getClipBoard().isDisplay();        	if (browser == null)        		 throw new NullPointerException("The browser cannot be NULL.");        	view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));        	model.refreshBrowser(roots, flat);        	model.createClipBoard();            model.getClipBoard().addPropertyChangeListener(controller);        	model.fireThumbnailLoading();            //b/c fireThumbnailLoading() sets the state to READY if there is no            //image.            if (model.getBrowser().getImages().size() == 0)             	setStatus("Done", -1);            else setStatus(HiViewer.PAINTING_TEXT, -1);            fireStateChange();        	if (model.getTreeView() != null) {        		model.createTreeView();        		view.showTreeView(true);        	}        	view.showClipBoard(isClipBoardDisplay);        	view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));        }    }