Search in sources :

Example 6 with ILineBreakpoint

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;
}
Also used : IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) FileEditorInput(org.eclipse.ui.part.FileEditorInput) LocalFileStorage(org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage) IErlModule(org.erlide.engine.model.root.IErlModule) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IErlElementLocator(org.erlide.engine.model.root.IErlElementLocator)

Example 7 with ILineBreakpoint

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);
    }
}
Also used : ErlangLineBreakpoint(org.erlide.backend.debug.ErlangLineBreakpoint) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IResource(org.eclipse.core.resources.IResource) ITextSelection(org.eclipse.jface.text.ITextSelection) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) ErlangLineBreakpoint(org.erlide.backend.debug.ErlangLineBreakpoint)

Example 8 with ILineBreakpoint

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());
}
Also used : IErlElement(org.erlide.engine.model.IErlElement) CoreException(org.eclipse.core.runtime.CoreException) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IErlangBreakpoint(org.erlide.backend.debug.IErlangBreakpoint)

Example 9 with ILineBreakpoint

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);
    }
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IResource(org.eclipse.core.resources.IResource) ITextSelection(org.eclipse.jface.text.ITextSelection) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) XSLLineBreakpoint(org.eclipse.wst.xsl.launching.model.XSLLineBreakpoint) XSLLineBreakpoint(org.eclipse.wst.xsl.launching.model.XSLLineBreakpoint)

Example 10 with ILineBreakpoint

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) {
        }
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) CoreException(org.eclipse.core.runtime.CoreException) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IMarker(org.eclipse.core.resources.IMarker) URL(java.net.URL)

Aggregations

ILineBreakpoint (org.eclipse.debug.core.model.ILineBreakpoint)13 CoreException (org.eclipse.core.runtime.CoreException)8 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)8 IResource (org.eclipse.core.resources.IResource)5 ITextSelection (org.eclipse.jface.text.ITextSelection)5 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)3 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 IMarker (org.eclipse.core.resources.IMarker)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IErlElement (org.erlide.engine.model.IErlElement)2 IErlElementLocator (org.erlide.engine.model.root.IErlElementLocator)2 IErlModule (org.erlide.engine.model.root.IErlModule)2 DatabaseLineBreakpoint (org.jkiss.dbeaver.debug.core.breakpoints.DatabaseLineBreakpoint)2 IDatabaseBreakpoint (org.jkiss.dbeaver.debug.core.breakpoints.IDatabaseBreakpoint)2 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2 FMLineBreakpoint (com.liferay.ide.portal.core.debug.fm.FMLineBreakpoint)1 Breakpoint (freemarker.debug.Breakpoint)1