Search in sources :

Example 1 with DatabaseDebugTarget

use of org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget 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 DatabaseDebugTarget

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

the class DebugCore method getSourceName.

public static String getSourceName(Object object) throws CoreException {
    if (object instanceof DatabaseStackFrame) {
        DatabaseStackFrame frame = (DatabaseStackFrame) object;
        Object sourceIdentifier = frame.getSourceIdentifier();
        DatabaseDebugTarget debugTarget = frame.getDatabaseDebugTarget();
        DBSObject dbsObject = null;
        try {
            dbsObject = debugTarget.findDatabaseObject(sourceIdentifier, new VoidProgressMonitor());
        } catch (DBException e) {
            Status error = DebugCore.newErrorStatus(e.getMessage(), e);
            throw new CoreException(error);
        }
        if (dbsObject == null) {
            return null;
        }
        final DBNModel navigatorModel = DBeaverCore.getInstance().getNavigatorModel();
        DBNDatabaseNode node = navigatorModel.getNodeByObject(dbsObject);
        if (node != null) {
            return node.getNodeItemPath();
        }
    }
    if (object instanceof String) {
        // well, let's be positive and assume it's a node path already
        return (String) object;
    }
    return null;
}
Also used : DatabaseStackFrame(org.jkiss.dbeaver.debug.core.model.DatabaseStackFrame) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBException(org.jkiss.dbeaver.DBException) DatabaseDebugTarget(org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget) CoreException(org.eclipse.core.runtime.CoreException) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) VoidProgressMonitor(org.jkiss.dbeaver.model.runtime.VoidProgressMonitor) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Example 3 with DatabaseDebugTarget

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

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)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)3 DatabaseDebugTarget (org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget)3 DBGController (org.jkiss.dbeaver.debug.DBGController)2 DatabaseProcess (org.jkiss.dbeaver.debug.core.model.DatabaseProcess)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 DBException (org.jkiss.dbeaver.DBException)1 DatabaseStackFrame (org.jkiss.dbeaver.debug.core.model.DatabaseStackFrame)1 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)1 DBNModel (org.jkiss.dbeaver.model.navigator.DBNModel)1 VoidProgressMonitor (org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)1 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)1