提交 19ad2078 编写于 作者: S Serge Rider

SQLPlan adapter


Former-commit-id: 21cafb2d
上级 990ce638
......@@ -1528,7 +1528,7 @@ public class SQLEditor extends SQLEditorBase implements
private void explainQueryPlan(SQLQuery sqlQuery)
{
// 1. Determine whether planner supports plan extraction
DBCQueryPlanner planner = DBUtils.getAdapter(DBCQueryPlanner.class, getDataSource());
DBCQueryPlanner planner = GeneralUtils.adapt(getDataSource(), DBCQueryPlanner.class);
if (planner == null) {
DBWorkbench.getPlatformUI().showError("Execution plan", "Execution plan explain isn't supported by current datasource");
return;
......
......@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.plan.DBCQueryPlanner;
import org.jkiss.dbeaver.ui.ActionUtils;
import org.jkiss.dbeaver.ui.editors.text.parser.SQLIdentifierDetector;
import org.jkiss.dbeaver.utils.GeneralUtils;
/**
* SQLEditorPropertyTester
......@@ -62,7 +63,7 @@ public class SQLEditorPropertyTester extends PropertyTester
// Do not check hasActiveQuery - sometimes jface don't update action enablement after cursor change/typing
return true;/* && (!"statement".equals(expectedValue) || editor.hasActiveQuery())*/
case PROP_CAN_EXPLAIN:
return hasConnection && DBUtils.getAdapter(DBCQueryPlanner.class, editor.getDataSource()) != null;
return hasConnection && GeneralUtils.adapt(editor.getDataSource(), DBCQueryPlanner.class) != null;
case PROP_CAN_NAVIGATE: {
// Check whether some word is under cursor
ISelectionProvider selectionProvider = editor.getSelectionProvider();
......
......@@ -57,6 +57,7 @@ import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorActivator;
import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages;
import org.jkiss.dbeaver.ui.editors.sql.plan.registry.SQLPlanViewDescriptor;
import org.jkiss.dbeaver.ui.editors.sql.plan.registry.SQLPlanViewRegistry;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.CommonUtils;
import java.lang.reflect.InvocationTargetException;
......@@ -228,7 +229,7 @@ public class ExplainPlanViewer extends Viewer implements IAdaptable
DBCExecutionContext executionContext = contextProvider.getExecutionContext();
if (executionContext != null) {
DBPDataSource dataSource = executionContext.getDataSource();
planner = DBUtils.getAdapter(DBCQueryPlanner.class, dataSource);
planner = GeneralUtils.adapt(dataSource, DBCQueryPlanner.class);
} else {
planner = null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册