class DocumentPropertyCell extends TreeCell<DocumentProperty> {

        private final ChangeListener<Boolean> change = (ob, o, enabled) -> {
            if (enabled) {
                enable();
            } else {
                disable();
            }
        };

        private final ProjectTreeComponent projectTreeComponent;

        DocumentPropertyCell(ProjectTreeComponent projectTreeComponent) {
            this.projectTreeComponent = requireNonNull(projectTreeComponent);

            // Listener should be initiated with a listener attached
            // that removes enabled-listeners attached to the previous
            // node when a new node is selected.
            itemProperty().addListener((ob, o, n) -> {

                if (o instanceof HasEnabledProperty) {
                    final HasEnabledProperty hasEnabled = (HasEnabledProperty) o;
                    hasEnabled.enabledProperty().removeListener(change);
                }

                if (n instanceof HasEnabledProperty) {
                    final HasEnabledProperty hasEnabled = (HasEnabledProperty) n;
                    hasEnabled.enabledProperty().addListener(change);
                }
            });
        }

        private void disable() {
            getStyleClass().add("gui-disabled");
        }

        private void enable() {
            while (getStyleClass().remove("gui-disabled")) {
                // Do nothing.
            }
        }

        @Override
        protected void updateItem(DocumentProperty item, boolean empty) {
            // item can be null
            super.updateItem(item, empty);

            if (empty || item == null) {
                textProperty().unbind();

                setText(null);
                setGraphic(null);
                setContextMenu(null);

                disable();
            } else {
                final ImageView icon;

                if (item instanceof HasIconPath) {
                    final HasIconPath hasIcon = (HasIconPath) item;
                    icon = new ImageView(new Image(hasIcon.getIconPath()));
                } else {
                    icon = SpeedmentIcon.forNode(item);
                }

                setGraphic(icon);

                if (item instanceof HasNameProperty) {
                    @SuppressWarnings("unchecked")
                    final HasNameProperty withName = (HasNameProperty) item;
                    textProperty().bind(withName.nameProperty());
                } else {
                    textProperty().unbind();
                    textProperty().setValue(null);
                }

                projectTreeComponent.createContextMenu(this, item)
                    .ifPresent(this::setContextMenu);

                updateEnabled(item);

                getTreeView().refresh();
            }
        }

        private void updateEnabled(DocumentProperty item) {<FILL_FUNCTION_BODY>}
    }

            boolean indicateEnabled = HasEnabled.test(item);

            if (item instanceof ColumnProperty) {
                indicateEnabled &= ((ColumnProperty) item).getParentOrThrow().isEnabled();
            } else if (item instanceof IndexProperty) {
                indicateEnabled &= ((IndexProperty) item).getParentOrThrow().isEnabled();
            } else if (item instanceof PrimaryKeyColumnProperty) {
                indicateEnabled &= ((PrimaryKeyColumnProperty) item).getParentOrThrow().isEnabled();
            }

            if (indicateEnabled) {
                enable();
            } else {
                disable();
            }
        
<no_super_class>