use of org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint 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);
}
use of org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint in project dbeaver by dbeaver.
the class ToggleProcedureBreakpointTarget method toggleLineBreakpoints.
@Override
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
IEditorPart editorPart = (IEditorPart) part;
IResource resource = extractResource(editorPart, selection);
if (resource == null) {
return;
}
DBSObject databaseObject = DebugUI.extractDatabaseObject(editorPart);
if (databaseObject == null) {
return;
}
DBNDatabaseNode node = DBeaverCore.getInstance().getNavigatorModel().getNodeByObject(databaseObject);
if (node == null) {
return;
}
String nodeItemPath = node.getNodeItemPath();
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCore.MODEL_IDENTIFIER_DATABASE);
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (breakpoint instanceof IDatabaseBreakpoint) {
IDatabaseBreakpoint databaseBreakpoint = (IDatabaseBreakpoint) breakpoint;
if (nodeItemPath.equals(databaseBreakpoint.getNodePath())) {
if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
DebugUITools.deleteBreakpoints(new IBreakpoint[] { breakpoint }, part.getSite().getShell(), null);
return;
}
}
}
}
int charstart = -1, charend = -1;
// create line breakpoint (doc line numbers start at 0)
new DatabaseLineBreakpoint(databaseObject, node, resource, lineNumber + 1, charstart, charend, true);
}
Aggregations