use of org.pentaho.di.ui.repository.RepositoriesDialog in project pentaho-kettle by pentaho.
the class Spoon method openRepository.
public void openRepository() {
// Check to tabs are dirty and warn user that they must save tabs prior to connecting. Don't connect!
if (Spoon.getInstance().isTabsChanged()) {
MessageBox mb = new MessageBox(Spoon.getInstance().getShell(), SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.WarnToSaveAllPriorToConnect.Message"));
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.WarnToCloseAllForce.Disconnect.Title"));
mb.open();
// Don't connect, user will need to save all their dirty tabs.
return;
}
loginDialog = new RepositoriesDialog(shell, null, new ILoginCallback() {
@Override
public void onSuccess(Repository repository) {
// Close previous repository...
if (rep != null) {
rep.disconnect();
SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.REPOSITORY_DISCONNECTED);
}
setRepository(repository);
loadSessionInformation(repository, true);
refreshTree();
setShellText();
SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.REPOSITORY_CONNECTED);
}
@Override
public void onError(Throwable t) {
closeRepository();
onLoginError(t);
}
@Override
public void onCancel() {
}
});
loginDialog.show();
}
Aggregations