use of net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView 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);
}
use of net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView in project tdq-studio-se by Talend.
the class ConnectionsView method openNewEditor.
public void openNewEditor(User user) {
try {
// First time we connect, get the database structure view up too
if (!user.hasAuthenticated()) {
DatabaseStructureView dsView = SQLExplorerPlugin.getDefault().getDatabaseStructureView();
dsView.addUser(user);
}
SQLEditorInput input = new SQLEditorInput("SQL Editor (" + SQLExplorerPlugin.getDefault().getEditorSerialNo() + // $NON-NLS-1$ $NON-NLS-2$
").sql");
input.setUser(user);
IWorkbenchPage page = SQLExplorerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.openEditor(input, SQLEditor.class.getName());
} catch (SQLCannotConnectException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.getString("ConnectionsView.cannotConnect"), e.getMessage());
} catch (Throwable e) {
SQLExplorerPlugin.error(Messages.getString("ConnectionsView.errCreateSql"), e);
}
}
use of net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView in project tdq-studio-se by Talend.
the class NewDatabaseStructureViewAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
DatabaseStructureView view = SQLExplorerPlugin.getDefault().getDatabaseStructureView();
if (view == null) {
return;
}
Collection<User> users = getView().getSelectedUsers(true);
for (User user : users) {
try {
// ADD msjian TDQ-8535 2014-4-25: we need to do this to make sure the hive connection can be created
// successfully
setMetadataToUserAndUpdateDriver(user);
// TDQ-8535~
view.addUser(user);
} catch (SQLCannotConnectException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Cannot connect", e.getMessage());
}
}
}
use of net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView in project tdq-studio-se by Talend.
the class SqlexplorerService method removeAliasInSQLExplorer.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.service.ISqlexplorerService#removeAliasInSQLExplorer(orgomg.cwm.foundation.softwaredeployment
* .DataProvider[])
*/
@Override
public void removeAliasInSQLExplorer(DataProvider... dataproviders) {
SQLExplorerPlugin sqlPlugin = SQLExplorerPlugin.getDefault();
AliasManager aliasManager = sqlPlugin.getAliasManager();
DatabaseStructureView dsView = sqlPlugin.findDatabaseStructureView();
// alias from propertyFile map at the same time.
try {
Collection<Alias> aliases = aliasManager.getAliases();
if (aliases.isEmpty()) {
return;
}
for (DataProvider dataProvider : dataproviders) {
String aliasName = dataProvider.getName();
if (null == aliasName) {
continue;
}
Alias alias = aliasManager.getAlias(aliasName);
if (alias != null) {
sqlPlugin.getPropertyFile().remove(alias);
aliasManager.removeAlias(aliasName);
}
// if the ctabItem is open,close it.
if (dsView != null) {
dsView.closeCurrentCabItem(aliasName);
}
}
} catch (Exception e) {
log.error(e, e);
}
aliasManager.modelChanged();
}
use of net.sourceforge.sqlexplorer.plugin.views.DatabaseStructureView in project tdq-studio-se by Talend.
the class SqlexplorerService method updateConnetionAliasByName.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.service.ISqlexplorerService#updateConnetionAliasByName(org.talend.core.model.metadata.
* builder.connection.Connection, java.lang.String)
*/
@Override
public void updateConnetionAliasByName(Connection connection, String aliasName) {
if (connection == null || aliasName == null) {
return;
}
SQLExplorerPlugin sqlPlugin = SQLExplorerPlugin.getDefault();
// if the ctabItem is open,close it.
DatabaseStructureView view = sqlPlugin.findDatabaseStructureView();
if (view != null) {
view.closeCurrentCabItem(aliasName);
}
AliasManager aliasManager = sqlPlugin.getAliasManager();
Alias alias = aliasManager.getAlias(aliasName);
if (alias != null) {
try {
aliasManager.removeAlias(aliasName);
addConnetionAliasToSQLPlugin(connection);
} catch (Exception e) {
log.error(e, e);
}
}
}
Aggregations