use of org.eclipse.debug.core.model.IBreakpoint in project erlide_eclipse by erlang.
the class ErlangProcess method getBreakpoints.
@Override
public IBreakpoint[] getBreakpoints() {
IStackFrame top = null;
try {
top = getTopStackFrame();
} catch (final DebugException e1) {
// can never happen
}
if (top instanceof ErlangStackFrame) {
final ErlangStackFrame topFrame = (ErlangStackFrame) top;
final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
final IBreakpoint[] breakpoints = breakpointManager.getBreakpoints();
for (final IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof ErlangLineBreakpoint) {
final ErlangLineBreakpoint lineBreakpoint = (ErlangLineBreakpoint) breakpoint;
try {
if (lineBreakpoint.getModule().equals(topFrame.getModule()) && lineBreakpoint.getLineNumber() == topFrame.getLineNumber()) {
return new IBreakpoint[] { lineBreakpoint };
}
} catch (final DebugException e) {
ErlLogger.warn(e);
} catch (final CoreException e) {
ErlLogger.warn(e);
}
}
}
}
return new IBreakpoint[0];
}
use of org.eclipse.debug.core.model.IBreakpoint in project erlide_eclipse by erlang.
the class BackendData method addBreakpointProjectsAndModules.
public static Set<String> addBreakpointProjectsAndModules(final Collection<IProject> projects, final List<String> interpretedModules) {
final IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager();
final Set<String> result = new HashSet<>(interpretedModules);
for (final IBreakpoint bp : bpm.getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL)) {
final IMarker m = bp.getMarker();
final IResource r = m.getResource();
final String name = r.getName();
if (SourceKind.hasErlExtension(name)) {
final IProject p = r.getProject();
if (projects == null || projects.contains(p)) {
final String s = p.getName() + ":" + name;
result.add(s);
}
}
}
return result;
}
use of org.eclipse.debug.core.model.IBreakpoint in project erlide_eclipse by erlang.
the class ErlangBreakpointPropertiesRulerAction method update.
/**
* @see IUpdate#update()
*/
@Override
public void update() {
fBreakpoint = null;
final IBreakpoint breakpoint = getBreakpoint();
if (breakpoint instanceof IErlangBreakpoint) {
fBreakpoint = breakpoint;
}
setEnabled(fBreakpoint != null);
}
use of org.eclipse.debug.core.model.IBreakpoint in project liferay-ide by liferay.
the class RemoteJSPBreakpointProvider method addBreakpoint.
@Override
public IStatus addBreakpoint(IDocument document, IEditorInput input, int editorLineNumber, int offset) throws CoreException {
// check if there is a valid position to set breakpoint
int pos = getValidPosition(document, editorLineNumber);
IStatus status = null;
if (pos >= 0) {
IResource res = getResourceFromInput(input);
if (res != null) {
String path = null;
// IDE-648 IDE-110
// get docroot relative path
final IWebProject lrproject = LiferayCore.create(IWebProject.class, res.getProject());
if (lrproject != null) {
final IFolder webappRoot = lrproject.getDefaultDocrootFolder();
if (webappRoot != null && webappRoot.exists()) {
IPath relativePath = res.getFullPath().makeRelativeTo(webappRoot.getFullPath());
if (relativePath != null && relativePath.segmentCount() > 0) {
// $NON-NLS-1$
path = "/" + relativePath.toPortableString();
}
}
IBreakpoint point = JDIDebugModel.createStratumBreakpoint(res, "JSP", res.getName(), path, getClassPattern(res), editorLineNumber, pos, pos, 0, true, null);
if (point == null) {
status = new Status(IStatus.ERROR, JSPUIPlugin.ID, IStatus.ERROR, "unsupported input type", null);
}
}
} else if (input instanceof IStorageEditorInput) {
// For non-resources, use the workspace root and a coordinated
// attribute that is used to
// prevent unwanted (breakpoint) markers from being loaded
// into the editors.
res = ResourcesPlugin.getWorkspace().getRoot();
String id = input.getName();
if (input instanceof IStorageEditorInput && ((IStorageEditorInput) input).getStorage() != null && ((IStorageEditorInput) input).getStorage().getFullPath() != null) {
id = ((IStorageEditorInput) input).getStorage().getFullPath().toString();
}
Map attributes = new HashMap();
attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, id);
String path = null;
IBreakpoint point = JDIDebugModel.createStratumBreakpoint(res, "JSP", input.getName(), path, getClassPattern(res), editorLineNumber, pos, pos, 0, true, // $NON-NLS-1$
attributes);
if (point == null) {
// $NON-NLS-1$
status = new Status(IStatus.ERROR, JSPUIPlugin.ID, IStatus.ERROR, "unsupported input type", null);
}
}
} else {
status = new Status(IStatus.INFO, JSPUIPlugin.ID, IStatus.INFO, JSPUIMessages.BreakpointNotAllowed, null);
}
if (status == null) {
status = new Status(IStatus.OK, JSPUIPlugin.ID, IStatus.OK, JSPUIMessages.OK, null);
}
return status;
}
use of org.eclipse.debug.core.model.IBreakpoint in project liferay-ide by liferay.
the class PortalSourceLookupParticipant method getTemplateName.
private String getTemplateName(IStackFrame frame) throws DebugException {
String retval = null;
IThread thread = frame.getThread();
IBreakpoint[] bps = thread.getBreakpoints();
if (bps.length == 1) {
IBreakpoint bp = thread.getBreakpoints()[0];
retval = bp.getMarker().getAttribute(ILRDebugConstants.FM_TEMPLATE_NAME, null);
} else {
if (thread instanceof FMThread) {
FMThread fmThread = (FMThread) thread;
Breakpoint stepBp = fmThread.getStepBreakpoint();
if (stepBp != null) {
// $NON-NLS-1$
retval = stepBp.getTemplateName().replaceAll(FMDebugTarget.FM_TEMPLATE_SERVLET_CONTEXT, "");
}
}
}
return retval;
}
Aggregations