dbeaver / dbeaver/dbeaver

Connection type color changes are not immediately reflected in Database Navigator

Closed
#41,787 4 comments 0 reactions 1 assignee Claimed by @Matvey16 View on GitHub
external xf:navigator
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 10h
Merged PRs (30d)
185

Description

### Description

Changing a connection type's color does not reliably update the corresponding connections in the connection navigator tree. The new color is saved correctly, but the connection navigator tree may continue displaying the old color until another UI refresh occurs or DBeaver is restarted.

The issue occurs when changing the connection type's color for the second time or subsequent times. The first color change is reflected correctly in the Connection Navigator, but subsequent color changes may not be reflected until the navigator is refreshed or DBeaver is restarted.

### DBeaver Version

Community Edition 26.2.0

### Operating System

Windows 10 Pro

### Database and driver

_No response_

### Steps to reproduce

1. Select the connection in the Connections Navigator tree.
Image

2. Right click on the connection and select "Edit Connection".
3. Choose **General** -> Edit connection types

Image

4. Change the color of the connection. In this example, I change the color to **Red** for both light and dark themes. Click Apply and Close. then click **OK**

Image

5. The connection color is changed to Red.

Image

6. Do the same steps to change the color to **Green**. Click Apply and Close. then click **OK**

Image

7. The connection color is not changed to Green. It remains Red.

Image

### Expected behavior

The affected connection nodes in the Database Navigator should immediately update to the new connection type color after clicking Apply/OK.

For example:
Red → Green → Blue

should be reflected immediately in the navigator without requiring a restart.

### Additional context

# Root cause
In [PrefPageConnectionTypes.performOk()](https://github.com/dbeaver/dbeaver/blob/devel/plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageConnectionTypes.java#L597), the update notification is currently sent using:
```java
new DBPEvent(DBPEvent.Action.OBJECT_UPDATE, null, dsReg)
```

The event therefore contained no specific connection object.

[DBNProjectDatabases.handleDataSourceEvent()](https://github.com/dbeaver/dbeaver/blob/devel/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNProjectDatabases.java#L438) attempts to locate the affected navigator node using:
```java
model.getNodeByObject(event.getObject())
```

Since `event.getObject()` is `null`, no `DBNDatabaseNode` is found and `fireNodeUpdate()` is not called. As a result, the affected connection is not explicitly repainted in the navigator.

## Question
Is sending an `OBJECT_UPDATE` event with a `null` object intentional and expected for this?

If so, should `DBNProjectDatabases.handleDataSourceEvent()` handle this case by refreshing the affected registry/nodes?

Alternatively, should PrefPageConnectionTypes.performOk() send an OBJECT_UPDATE event containing each affected DBPDataSourceContainer so that the navigator can update the corresponding node directly?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.