use of org.jkiss.dbeaver.model.exec.DBCExecutionContext in project dbeaver by dbeaver.
the class AbstractSessionEditor method createEditorControl.
@Override
public void createEditorControl(Composite parent) {
final DBCExecutionContext executionContext = getExecutionContext();
if (executionContext != null) {
setPartName("Sessions - " + executionContext.getDataSource().getContainer().getName());
sessionsViewer = createSessionViewer(executionContext, parent);
sessionsViewer.loadSettings(this);
sessionsViewer.refreshSessions();
}
}
use of org.jkiss.dbeaver.model.exec.DBCExecutionContext in project dbeaver by dbeaver.
the class NavigatorUtils method addSetDefaultObjectAction.
private static void addSetDefaultObjectAction(IWorkbenchSite workbenchSite, IMenuManager manager, DBNNode selectedNode) {
// Add "Set active object" menu
boolean addSetActive = false;
if (selectedNode.isPersisted() && selectedNode instanceof DBNDatabaseNode && !(selectedNode instanceof DBNDatabaseFolder) && ((DBNDatabaseNode) selectedNode).getObject() != null) {
DBSObject selectedObject = ((DBNDatabaseNode) selectedNode).getObject();
DBPDataSource dataSource = ((DBNDatabaseNode) selectedNode).getDataSource();
if (dataSource != null) {
DBCExecutionContext defaultContext = dataSource.getDefaultInstance().getDefaultContext(new VoidProgressMonitor(), false);
DBCExecutionContextDefaults contextDefaults = defaultContext.getContextDefaults();
if (contextDefaults != null) {
if ((selectedObject instanceof DBSCatalog && contextDefaults.supportsCatalogChange() && contextDefaults.getDefaultCatalog() != selectedObject) || (selectedObject instanceof DBSSchema && contextDefaults.supportsSchemaChange() && contextDefaults.getDefaultSchema() != selectedObject)) {
addSetActive = true;
}
}
}
}
if (addSetActive) {
manager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_SET_DEFAULT));
}
manager.add(new Separator());
}
use of org.jkiss.dbeaver.model.exec.DBCExecutionContext in project dbeaver by dbeaver.
the class ResultSetValueController method getValueManager.
@Override
public IValueManager getValueManager() {
DBSAttributeBase valueType = binding.getPresentationAttribute();
final DBCExecutionContext executionContext = getExecutionContext();
Class<?> valueObjectType = binding.getValueHandler().getValueObjectType(valueType);
if (valueObjectType == Object.class) {
// Try to get type from value itself
Object value = getValue();
if (value != null) {
valueObjectType = value.getClass();
}
}
return ValueManagerRegistry.findValueManager(executionContext == null ? null : executionContext.getDataSource(), valueType, valueObjectType);
}
use of org.jkiss.dbeaver.model.exec.DBCExecutionContext in project dbeaver by dbeaver.
the class ResultSetFilterPanel method setCustomDataFilter.
private void setCustomDataFilter() {
DBCExecutionContext context = viewer.getExecutionContext();
if (context == null) {
return;
}
String condition = filtersText.getText();
StringBuilder currentCondition = new StringBuilder();
SQLUtils.appendConditionString(viewer.getModel().getDataFilter(), context.getDataSource(), null, currentCondition, true);
if (currentCondition.toString().trim().equals(condition.trim())) {
// The same
return;
}
DBDDataFilter newFilter = new DBDDataFilter(viewer.getModel().getDataFilter());
for (DBDAttributeConstraint ac : newFilter.getConstraints()) {
ac.setCriteria(null);
}
newFilter.setWhere(condition);
viewer.setDataFilter(newFilter, true);
// viewer.getControl().setFocus();
}
use of org.jkiss.dbeaver.model.exec.DBCExecutionContext in project dbeaver by dbeaver.
the class ExplainPlanViewer method refresh.
@Override
public void refresh() {
DBCQueryPlanner planner;
DBCExecutionContext executionContext = contextProvider.getExecutionContext();
if (executionContext != null) {
DBPDataSource dataSource = executionContext.getDataSource();
planner = GeneralUtils.adapt(dataSource, DBCQueryPlanner.class);
} else {
planner = null;
}
if (planner == null) {
DBWorkbench.getPlatformUI().showError("No SQL Plan", "This datasource doesn't support execution plans");
} else {
explainService = LoadingJob.createService(new ExplainPlanService(planner, executionContext, lastQuery.getText(), lastQueryId), planPresentationContainer.createVisualizer());
explainService.schedule();
}
}
Aggregations