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;
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project erlide_eclipse by erlang.
the class ErlLineBreakpointAdapter method toggleLineBreakpoints.
@Override
public void toggleLineBreakpoints(final IWorkbenchPart part, final ISelection selection) throws CoreException {
final ITextEditor textEditor = getEditor(part);
if (textEditor != null) {
final IResource resource = textEditor.getEditorInput().getAdapter(IResource.class);
if (resource == null) {
return;
}
final ITextSelection textSelection = (ITextSelection) selection;
final int lineNumber = textSelection.getStartLine();
final IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL);
for (final IBreakpoint breakpoint : breakpoints) {
if (resource.equals(breakpoint.getMarker().getResource())) {
if (breakpoint instanceof ILineBreakpoint) {
final ILineBreakpoint lineBr = (ILineBreakpoint) breakpoint;
if (lineBr.getLineNumber() == lineNumber + 1) {
breakpoint.delete();
return;
}
}
}
}
// create line breakpoint (doc line numbers start at 0)
final ErlangLineBreakpoint lineBreakpoint = new ErlangLineBreakpoint();
lineBreakpoint.createMarker(resource, lineNumber + 1);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project erlide_eclipse by erlang.
the class ErlangLineBreakpointPropertyPage method createTypeSpecificLabels.
@Override
protected void createTypeSpecificLabels(final Composite parent) {
createLabel(parent, "Module:");
final String moduleName = getBreakpoint().getMarker().getResource().getName();
createText(parent, SWT.READ_ONLY, moduleName).setBackground(parent.getBackground());
// Line number
final ILineBreakpoint breakpoint = (ILineBreakpoint) getBreakpoint();
final StringBuilder lineNumber = new StringBuilder(4);
try {
final int lNumber = breakpoint.getLineNumber();
if (lNumber > 0) {
lineNumber.append(lNumber);
}
} catch (final CoreException ce) {
ErlLogger.error(ce);
}
if (lineNumber.length() > 0) {
createLabel(parent, "&Line Number:");
final String string = lineNumber.toString();
createText(parent, SWT.READ_ONLY, string).setBackground(parent.getBackground());
}
final IErlElement element = BreakpointUtils.getElement(breakpoint);
if (element == null) {
return;
}
createLabel(parent, "Function:");
createText(parent, SWT.READ_ONLY, element.toString()).setBackground(parent.getBackground());
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project webtools.sourceediting by eclipse.
the class XSLLineBreakpointAdapter method toggleLineBreakpoints.
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
ITextEditor textEditor = getEditor(part);
if (textEditor != null) {
IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
for (IBreakpoint breakpoint : breakpoints) {
if (resource.equals(breakpoint.getMarker().getResource())) {
if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
// remove
breakpoint.delete();
return;
}
}
}
// create line breakpoint (doc line numbers start at 0)
XSLLineBreakpoint lineBreakpoint = new XSLLineBreakpoint(resource, lineNumber + 1, 1, 1);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
use of org.eclipse.debug.core.model.ILineBreakpoint in project webtools.sourceediting by eclipse.
the class JAXPDebugTarget method breakpointAdded.
public void breakpointAdded(IBreakpoint breakpoint) {
if (supportsBreakpoint(breakpoint)) {
try {
ILineBreakpoint lb = (ILineBreakpoint) breakpoint;
if (breakpoint.isEnabled()) {
try {
IMarker marker = lb.getMarker();
if (marker != null) {
URL file = marker.getResource().getLocation().toFile().toURI().toURL();
sendRequest(DebugConstants.REQUEST_ADD_BREAKPOINT + " " + file + " " + // $NON-NLS-1$ //$NON-NLS-2$
lb.getLineNumber());
}
} catch (CoreException e) {
JAXPLaunchingPlugin.log(e);
} catch (MalformedURLException e) {
JAXPLaunchingPlugin.log(e);
}
}
} catch (CoreException e) {
}
}
}
Aggregations