Search in sources :

Example 1 with DatabaseProcess

use of org.jkiss.dbeaver.debug.core.model.DatabaseProcess in project dbeaver by serge-rider.

the class DatabaseLaunchDelegate method launch.

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    DBPDataSourceContainer datasourceDescriptor = DebugUtils.getDataSourceContainer(configuration);
    DBGController controller = createController(datasourceDescriptor, configuration.getAttributes());
    if (controller == null) {
        String message = NLS.bind("Unable to find debug controller for datasource {0}", datasourceDescriptor);
        throw new CoreException(DebugUtils.newErrorStatus(message));
    }
    DatabaseProcess process = createProcess(launch, configuration.getName());
    DatabaseDebugTarget target = createDebugTarget(launch, controller, process);
    target.connect(monitor);
    launch.addDebugTarget(target);
}
Also used : DatabaseDebugTarget(org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget) CoreException(org.eclipse.core.runtime.CoreException) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBGController(org.jkiss.dbeaver.debug.DBGController) DatabaseProcess(org.jkiss.dbeaver.debug.core.model.DatabaseProcess)

Example 2 with DatabaseProcess

use of org.jkiss.dbeaver.debug.core.model.DatabaseProcess in project dbeaver by dbeaver.

the class DatabaseLaunchDelegate method launch.

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    String datasourceId = DebugCore.extractDatasourceId(configuration);
    DataSourceDescriptor datasourceDescriptor = DataSourceRegistry.findDataSource(datasourceId);
    if (datasourceDescriptor == null) {
        String message = NLS.bind("Unable to find data source with id {0}", datasourceId);
        throw new CoreException(DebugCore.newErrorStatus(message));
    }
    Map<String, Object> attributes = extractAttributes(configuration);
    DBGController controller = createController(datasourceDescriptor);
    if (controller == null) {
        String message = NLS.bind("Unable to find debug controller for datasource {0}", datasourceDescriptor);
        throw new CoreException(DebugCore.newErrorStatus(message));
    }
    controller.init(attributes);
    DatabaseProcess process = createProcess(launch, configuration.getName());
    DatabaseDebugTarget target = createDebugTarget(launch, controller, process);
    target.connect(monitor);
    launch.addDebugTarget(target);
}
Also used : DatabaseDebugTarget(org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget) CoreException(org.eclipse.core.runtime.CoreException) DBGController(org.jkiss.dbeaver.debug.DBGController) DatabaseProcess(org.jkiss.dbeaver.debug.core.model.DatabaseProcess) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor)

Example 3 with DatabaseProcess

use of org.jkiss.dbeaver.debug.core.model.DatabaseProcess in project dbeaver by dbeaver.

the class DatabaseDebugModelPresentation method getText.

@Override
public String getText(Object element) {
    // FIXME:AF: register adapters
    try {
        if (element instanceof IDatabaseDebugTarget) {
            IDatabaseDebugTarget databaseDebugTarget = (IDatabaseDebugTarget) element;
            return databaseDebugTarget.getName();
        }
        if (element instanceof DatabaseProcess) {
            DatabaseProcess process = (DatabaseProcess) element;
            return process.getLabel();
        }
        if (element instanceof DatabaseThread) {
            DatabaseThread thread = (DatabaseThread) element;
            return thread.getName();
        }
        if (element instanceof DatabaseStackFrame) {
            DatabaseStackFrame stackFrame = (DatabaseStackFrame) element;
            return stackFrame.getName();
        }
        if (element instanceof DatabaseVariable) {
            DatabaseVariable variable = (DatabaseVariable) element;
            return variable.getName();
        }
        if (element instanceof DatabaseLineBreakpoint) {
            DatabaseLineBreakpoint breakpoint = (DatabaseLineBreakpoint) element;
            String database = breakpoint.getDatabaseName();
            String schema = breakpoint.getSchemaName();
            String procedure = breakpoint.getProcedureName();
            int lineNumber = breakpoint.getLineNumber();
            String pattern = "{0}.{1}.{2} - [line:{3}]";
            Object[] bindings = new Object[] { database, schema, procedure, lineNumber };
            return NLS.bind(pattern, bindings);
        }
    } catch (CoreException e) {
        return "<not responding>";
    }
    return labelProvider.getText(element);
}
Also used : IDatabaseDebugTarget(org.jkiss.dbeaver.debug.core.model.IDatabaseDebugTarget) DatabaseStackFrame(org.jkiss.dbeaver.debug.core.model.DatabaseStackFrame) DatabaseLineBreakpoint(org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint) CoreException(org.eclipse.core.runtime.CoreException) DatabaseThread(org.jkiss.dbeaver.debug.core.model.DatabaseThread) DBPScriptObject(org.jkiss.dbeaver.model.DBPScriptObject) DatabaseVariable(org.jkiss.dbeaver.debug.core.model.DatabaseVariable) DatabaseProcess(org.jkiss.dbeaver.debug.core.model.DatabaseProcess) DatabaseLineBreakpoint(org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)3 DatabaseProcess (org.jkiss.dbeaver.debug.core.model.DatabaseProcess)3 DBGController (org.jkiss.dbeaver.debug.DBGController)2 DatabaseDebugTarget (org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget)2 DatabaseLineBreakpoint (org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint)1 DatabaseStackFrame (org.jkiss.dbeaver.debug.core.model.DatabaseStackFrame)1 DatabaseThread (org.jkiss.dbeaver.debug.core.model.DatabaseThread)1 DatabaseVariable (org.jkiss.dbeaver.debug.core.model.DatabaseVariable)1 IDatabaseDebugTarget (org.jkiss.dbeaver.debug.core.model.IDatabaseDebugTarget)1 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)1 DBPScriptObject (org.jkiss.dbeaver.model.DBPScriptObject)1 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)1