BackgroundTask backgroundTask = new BackgroundTask(project, "Loading executable elements", false) {
@Override
public void execute(@NotNull ProgressIndicator progressIndicator) {
initProgressIndicator(progressIndicator, true);
final MethodBrowserSettings settings = MethodExecutionManager.getInstance(project).getBrowserSettings();
DBMethod currentMethod = configuration.getExecutionInput() == null ? null : configuration.getExecutionInput().getMethod();
if (currentMethod != null) {
settings.setConnectionHandler(currentMethod.getConnectionHandler());
settings.setSchema(currentMethod.getSchema());
settings.setMethod(currentMethod);
}
final ObjectTreeModel objectTreeModel = new ObjectTreeModel(settings.getSchema(), settings.getVisibleObjectTypes(), settings.getMethod());
new SimpleLaterInvocator() {
public void execute() {
final MethodExecutionBrowserDialog browserDialog = new MethodExecutionBrowserDialog(project, settings, objectTreeModel);
browserDialog.show();
if (browserDialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
DBMethod method = browserDialog.getSelectedMethod();
MethodExecutionManager methodExecutionManager = MethodExecutionManager.getInstance(project);
MethodExecutionInput methodExecutionInput = methodExecutionManager.getExecutionInput(method);
if (methodExecutionInput != null) {
configuration.setExecutionInput(methodExecutionInput);
}