Search in sources :

Example 1 with SessionEstablishedListener

use of net.sourceforge.sqlexplorer.connections.SessionEstablishedListener in project tdq-studio-se by Talend.

the class OpenPasswordConnectDialogAction method run.

public void run() {
    SessionEstablishedListener listener = null;
    if (!user.hasAuthenticated())
        listener = new SessionEstablishedAdapter() {

            @Override
            public void sessionEstablished(Session session) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        DatabaseStructureView dsView = SQLExplorerPlugin.getDefault().getDatabaseStructureView();
                        if (dsView != null)
                            try {
                                dsView.addUser(user);
                            } catch (SQLCannotConnectException e) {
                                MessageDialog.openError(Display.getDefault().getActiveShell(), "Cannot connect", e.getMessage());
                            }
                    }
                });
            }
        };
    ConnectionJob.createSession(alias, user, listener, alwaysPrompt);
}
Also used : SessionEstablishedListener(net.sourceforge.sqlexplorer.connections.SessionEstablishedListener) DatabaseStructureView(net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView) SessionEstablishedAdapter(net.sourceforge.sqlexplorer.connections.SessionEstablishedAdapter) Session(net.sourceforge.sqlexplorer.dbproduct.Session) SQLCannotConnectException(net.sourceforge.sqlexplorer.SQLCannotConnectException)

Example 2 with SessionEstablishedListener

use of net.sourceforge.sqlexplorer.connections.SessionEstablishedListener in project tdq-studio-se by Talend.

the class User method sessionEstablished.

/**
 * Callback when a session has been established; notifies the next listener in the queue and then starts to
 * establish a new session
 */
@Override
public synchronized void sessionEstablished(Session session) {
    SessionEstablishedListener listener = newSessionsQueue.removeFirst();
    listener.sessionEstablished(session);
    if (!newSessionsQueue.isEmpty()) {
        ConnectionJob.createSession(alias, this, this, false);
    }
}
Also used : SessionEstablishedListener(net.sourceforge.sqlexplorer.connections.SessionEstablishedListener)

Aggregations

SessionEstablishedListener (net.sourceforge.sqlexplorer.connections.SessionEstablishedListener)2 SQLCannotConnectException (net.sourceforge.sqlexplorer.SQLCannotConnectException)1 SessionEstablishedAdapter (net.sourceforge.sqlexplorer.connections.SessionEstablishedAdapter)1 Session (net.sourceforge.sqlexplorer.dbproduct.Session)1 DatabaseStructureView (net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView)1