Set images = model.getBrowser().getSelectedDisplays(); Iterator i = images.iterator(); while (i.hasNext()) { is = (ImageData) ((ImageDisplay) i.next()).getHierarchyObject();
if (model != null) { Set images = model.getBrowser().getSelectedDisplays(); Iterator i = images.iterator(); ImageDisplay d; while (i.hasNext()) { d = (ImageDisplay) i.next(); is = (ImageData) d.getHierarchyObject(); eventBus.post(new ViewImage(is.getId(), is.getDefaultPixels().getId(), is.getName())); } } else {
    public void execute()    {        if (model != null && hierarchyObject == null) {            ImageDisplay selectedDisplay = model.getBrowser().                                                    getLastSelectedDisplay();            hierarchyObject = (DataObject) selectedDisplay.getHierarchyObject();        }        if (hierarchyObject == null) return;        if (hierarchyObject instanceof DatasetData)            HiViewerAgent.browse(Browse.DATASET,                     ((DatasetData) hierarchyObject).getId(),                     model.getRootLevel(), model.getRootID());        else if (hierarchyObject instanceof ProjectData)            HiViewerAgent.browse(Browse.PROJECT,                     ((ProjectData) hierarchyObject).getId(),                    model.getRootLevel(), model.getRootID());        else if (hierarchyObject instanceof CategoryGroupData)            HiViewerAgent.browse(Browse.CATEGORY_GROUP,                     ((CategoryGroupData) hierarchyObject).getId(),                    model.getRootLevel(), model.getRootID());        else if (hierarchyObject instanceof CategoryData)            HiViewerAgent.browse(Browse.CATEGORY,                     ((CategoryData) hierarchyObject).getId(),                    model.getRootLevel(), model.getRootID());        else if (hierarchyObject instanceof ImageData) {            EventBus eventBus = HiViewerAgent.getRegistry().getEventBus();            ImageData is = (ImageData) hierarchyObject;            Set images = model.getBrowser().getSelectedDisplays();            Iterator i = images.iterator();            while (i.hasNext()) {                is = (ImageData) ((ImageDisplay) i.next()).getHierarchyObject();                eventBus.post(new ViewImage(is.getId(),                         is.getDefaultPixels().getId(), is.getName()));             }        }    }