if (p instanceof DatasetData) name = NAME_DATASET; else name = NAME_CATEGORY;
if (p instanceof DatasetData) { name = NAME_DATASET; putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_DATASET)); } else { name = NAME_CATEGORY; putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_CATEGORY)); }
    protected void onDisplayChange(TreeImageDisplay selectedDisplay)    {        if (selectedDisplay == null) {            name = NAME;            setEnabled(false);            return;        }                /*        if (model.getSelectedBrowser() != null) {            if (model.getSelectedBrowser().getSelectedDisplays().length > 1) {                setEnabled(false);                return;            }        }         */        Browser browser = model.getSelectedBrowser();        if (browser == null) {            name = NAME;            setEnabled(false);            return;        }         if (browser.getBrowserType() == Browser.IMAGES_EXPLORER) {            name = NAME;            setEnabled(false);            return;        }        Object ho = selectedDisplay.getUserObject();         if ((ho instanceof ProjectData) || (ho instanceof CategoryGroupData)) {            name = NAME;            setEnabled(model.isObjectWritable((DataObject) ho));        } else if (ho instanceof DatasetData) {            name = NAME_PROJECT;            setEnabled(model.isObjectWritable((DataObject) ho));        } else if (ho instanceof CategoryData) {            name = NAME_CATEGORYGROUP;            setEnabled(model.isObjectWritable((DataObject) ho));        } else if (ho instanceof ImageData) {            Object p = selectedDisplay.getParentDisplay().getUserObject();            if (p instanceof DatasetData) name = NAME_DATASET;            else name = NAME_CATEGORY;            setEnabled(model.isObjectWritable((DataObject) ho));        } else setEnabled(false);    }