use of org.eclipse.debug.core.model.ILineBreakpoint in project erlide_eclipse by erlang.
the class BreakpointUtils method getElement.
public static IErlElement getElement(final ILineBreakpoint breakpoint) {
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlElement element = model.findElement(breakpoint.getMarker().getResource());
if (element instanceof IErlModule) {
final IErlModule m = (IErlModule) element;
try {
m.open(null);
final int lineNumber = breakpoint.getLineNumber();
return m.getElementAtLine(lineNumber - 1);
} catch (final Exception e) {
ErlLogger.warn(e);
}
}
return null;
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project liferay-ide by liferay.
the class FMDebugTarget method getEnabledLineBreakpoints.
private ILineBreakpoint[] getEnabledLineBreakpoints() {
List<ILineBreakpoint> breakpoints = new ArrayList<ILineBreakpoint>();
final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
if (breakpointManager.isEnabled()) {
IBreakpoint[] fmBreakpoints = breakpointManager.getBreakpoints(getModelIdentifier());
for (IBreakpoint fmBreakpoint : fmBreakpoints) {
try {
if (fmBreakpoint instanceof ILineBreakpoint && supportsBreakpoint(fmBreakpoint) && fmBreakpoint.isEnabled()) {
breakpoints.add((ILineBreakpoint) fmBreakpoint);
}
} catch (CoreException e) {
}
}
}
return breakpoints.toArray(new ILineBreakpoint[0]);
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project webtools.sourceediting by eclipse.
the class JAXPDebugTarget method breakpointHit.
private void breakpointHit(String event) {
// determine which breakpoint was hit, and set the thread's breakpoint
int lastSpace = event.lastIndexOf(' ');
if (lastSpace > 0) {
String line = event.substring(lastSpace + 1);
int lineNumber = Integer.parseInt(line);
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
for (IBreakpoint breakpoint : breakpoints) {
if (supportsBreakpoint(breakpoint)) {
if (breakpoint instanceof ILineBreakpoint) {
ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
try {
if (lineBreakpoint.getLineNumber() == lineNumber) {
thread.setBreakpoints(new IBreakpoint[] { breakpoint });
break;
}
} catch (CoreException e) {
}
}
}
}
}
suspended(DebugEvent.BREAKPOINT);
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project dbeaver by serge-rider.
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 = DBWorkbench.getPlatform().getNavigatorModel().getNodeByObject(new VoidProgressMonitor(), databaseObject, false);
if (node == null) {
return;
}
String nodeItemPath = node.getNodeItemPath();
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DBGConstants.MODEL_IDENTIFIER_DATABASE);
for (IBreakpoint breakpoint : breakpoints) {
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;
DBGBreakpointDescriptor breakpointDescriptor = GeneralUtils.adapt(databaseObject, DBGBreakpointDescriptor.class);
if (breakpointDescriptor == null) {
throw new CoreException(GeneralUtils.makeErrorStatus("Object '" + DBUtils.getObjectFullName(databaseObject, DBPEvaluationContext.UI) + "' doesn't support breakpoints"));
}
// create line breakpoint (doc line numbers start at 0)
new DatabaseLineBreakpoint(databaseObject, node, resource, breakpointDescriptor, lineNumber + 1, charstart, charend, true);
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project erlide_eclipse by erlang.
the class ErlDebugModelPresentation method getEditorInput.
@Override
public IEditorInput getEditorInput(final Object element) {
if (element instanceof IFile) {
return new FileEditorInput((IFile) element);
}
if (element instanceof ILineBreakpoint) {
return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
}
if (element instanceof LocalFileStorage) {
final LocalFileStorage lfs = (LocalFileStorage) element;
try {
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlModule module = ErlangEngine.getInstance().getModelFindService().findModule(model, null, null, lfs.getFullPath().toString(), IErlElementLocator.Scope.ALL_PROJECTS);
return EditorUtility.getEditorInput(module);
} catch (final CoreException e) {
ErlLogger.error(e);
}
}
return null;
}
Aggregations