提交 8ab5d813 编写于 作者: S Serge Rider

#7770 SQL Editor: separate connection flag check fix

上级 87dc338e
......@@ -233,9 +233,7 @@ public class SQLEditor extends SQLEditorBase implements
if (executionContext != null) {
return executionContext;
}
if (dataSourceContainer != null &&
!dataSourceContainer.getPreferenceStore().getBoolean(SQLPreferenceConstants.EDITOR_SEPARATE_CONNECTION))
{
if (dataSourceContainer != null && !SQLEditorUtils.isOpenSeparateConnection(dataSourceContainer)) {
return DBUtils.getDefaultContext(getDataSource(), false);
}
return null;
......@@ -381,9 +379,8 @@ public class SQLEditor extends SQLEditorBase implements
// Datasource was changed or instance was changed (PG)
releaseExecutionContext();
curDataSource = dataSource;
if (dataSource.getContainer().getPreferenceStore().getBoolean(SQLPreferenceConstants.EDITOR_SEPARATE_CONNECTION) &&
!dataSource.getContainer().getDriver().isEmbedded())
{
DBPDataSourceContainer container = dataSource.getContainer();
if (SQLEditorUtils.isOpenSeparateConnection(container)) {
DBSInstance dsInstance = dataSource.getDefaultInstance();
String[] contextDefaults = EditorUtils.getInputContextDefaults(getEditorInput());
if (contextDefaults.length > 0 && contextDefaults[0] != null) {
......
......@@ -50,6 +50,11 @@ public class SQLEditorUtils {
public static final String SCRIPT_FILE_EXTENSION = "sql"; //$NON-NLS-1$
public static boolean isOpenSeparateConnection(DBPDataSourceContainer container) {
return container.getPreferenceStore().getBoolean(SQLPreferenceConstants.EDITOR_SEPARATE_CONNECTION) &&
!container.getDriver().isEmbedded();
}
public static IFolder getScriptsFolder(DBPProject project, boolean forceCreate) throws CoreException
{
if (project == null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册