public void update() { LayerTreeTreeNode selected = tree.getSelectedLayerTreeNode(); if (selected != null && action.isEnabled(selected.getLayer())) { setDisabled(false); setIcon(action.getIcon()); setTooltip(action.getTooltip()); } else { setDisabled(true); setIcon(action.getDisabledIcon()); setTooltip(""); } }