Bug 484930 - With several datasources, the IDE DB Viewer's datasource combobox control's initial selection and content are not in sync
Summary: With several datasources, the IDE DB Viewer's datasource combobox control's i...
Status: ASSIGNED
Alias: None
Product: Dirigible
Classification: ECD
Component: ide-db (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 8
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-27 17:17 EST by Georgi Pavlov CLA
Modified: 2017-08-21 07:00 EDT (History)
1 user (show)

See Also:


Attachments
dbviewer with toolbar combobox and tree not in sync (14.11 KB, image/png)
2015-12-27 17:17 EST, Georgi Pavlov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Georgi Pavlov CLA 2015-12-27 17:17:09 EST
Created attachment 258913 [details]
dbviewer with toolbar combobox and tree not in sync

I have two datasources defined in my dirigible instance besides the default Derby. The names are mongodb and postgre. My observation is that upon the IDE DB viewer's first initialization, the currently selected datasource in the toolbar combobox is postgre and the content is the tables of the default datasource (derby). See the screenshot in the attachment.

After some debugging here's what happens:
It seems that a SelectionEvent is never raised by DatabaseViewerToolBar's datasourcesCombo for programmatic selections, such as 
datasourcesCombo.select(0); /line 115 in DatabaseViewerToolBar/. As a consequence the listener method in DatabaseViewer is never invoked and the selected datasource is not set in CommonParameters. Next, DatabaseViewer tries to work on the database content tree and for that it requests the selected datasource from CommonParameters. Since it's not there it falls back to the default datasource and that is how we end up with selection for one datasource and content for another.
Comment 1 Georgi Pavlov CLA 2016-01-15 07:44:23 EST
https://github.com/eclipse/dirigible/commit/bac7637e407fa60d72ece8b15c56a1ecadb144f2

But it may take a more comprehensive solution that binds more tightly the selected datasource name and tree content provider