Search in sources :

Example 1 with DBNEvent

use of org.jkiss.dbeaver.model.navigator.DBNEvent in project dbeaver by serge-rider.

the class TabbedFolderPageNode method refreshPart.

@Override
public void refreshPart(Object source, boolean force) {
    if (!activated || itemControl == null || itemControl.isDisposed()) {
        return;
    }
    // Check - do we need to load new content in editor
    // If this is DBM event then check node change type
    // UNLOAD usually means that connection was closed on connection's node is not removed but
    // is in "unloaded" state.
    // Without this check editor will try to reload it's content and thus will reopen just closed connection
    // (by calling getChildren() on DBNNode)
    boolean loadNewData = true;
    if (!force && source instanceof DBNEvent) {
        DBNEvent event = (DBNEvent) source;
        DBNEvent.NodeChange nodeChange = event.getNodeChange();
        if (event.getAction() == DBNEvent.Action.UPDATE && nodeChange == DBNEvent.NodeChange.REFRESH) {
            // Do not refresh if refreshed object is not in the list
            loadNewData = isRefreshingEvent(event);
        } else if (nodeChange == DBNEvent.NodeChange.UNLOAD) {
            loadNewData = false;
        }
    }
    if (loadNewData) {
        itemControl.loadData(false);
    }
}
Also used : DBNEvent(org.jkiss.dbeaver.model.navigator.DBNEvent)

Aggregations

DBNEvent (org.jkiss.dbeaver.model.navigator.DBNEvent)1