Search in sources :

Example 6 with IErlangBreakpoint

use of org.erlide.backend.debug.IErlangBreakpoint in project erlide_eclipse by erlang.

the class ErlangLineBreakpointPropertyPage method createConditionEditor.

/**
 * Validates the watchpoint...if we are one
 */
// private void validateWatchpoint() {
// if (fEnabledButton.getSelection()
// && !(fFieldAccess.getSelection() || fFieldModification
// .getSelection())) {
// addErrorMessage(fgWatchpointError);
// } else {
// removeErrorMessage(fgWatchpointError);
// }
// }
/**
 * Validates the method breakpoint, if we are one
 */
// private void validateMethodBreakpoint() {
// boolean valid = true;
// if (fEnabledButton.getSelection()
// && !(fMethodEntry.getSelection() || fMethodExit.getSelection())) {
// setErrorMessage(fgMethodBreakpointError);
// valid = false;
// } else {
// setErrorMessage(null);
// }
// setValid(valid);
// }
/**
 * Creates the controls that allow the user to specify the breakpoint's condition
 *
 * @param parent
 *            the composite in which the condition editor should be created
 * @throws CoreException
 *             if an exception occurs accessing the breakpoint
 */
private void createConditionEditor(final Composite parent) throws CoreException {
    final IErlangBreakpoint breakpoint = getBreakpoint();
    // String label = null;
    // if (BreakpointUtils.getType(breakpoint) != null) {
    // final IBindingService bindingService = (IBindingService) PlatformUI
    // .getWorkbench().getAdapter(IBindingService.class);
    // if (bindingService != null) {
    // final TriggerSequence keyBinding = bindingService
    // .getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    // if (keyBinding != null) {
    // label = MessageFormat.format(
    // PropertyPageMessages.JavaLineBreakpointPage_12,
    // new String[] { keyBinding.format() });
    // }
    // }
    // }
    // if (label == null) {
    // label = PropertyPageMessages.JavaLineBreakpointPage_13;
    // }
    final Group g = new Group(parent, SWT.NONE);
    g.setLayout(new GridLayout(1, false));
    g.setText(ErlangBreakpointPropertyPage.EMPTY_STRING);
    g.setFont(parent.getFont());
    final GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 1;
    g.setLayoutData(gd);
    final Composite conditionComposite = g;
    fEnableConditionButton = createCheckButton(conditionComposite, "Enable");
    fEnableConditionButton.setSelection(breakpoint.isConditionEnabled());
    fEnableConditionButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            setConditionEnabled(fEnableConditionButton.getSelection());
        }
    });
    fConditionEditor = new BreakpointConditionEditor(conditionComposite, this);
    // fSuspendWhenLabel = createLabel(conditionComposite,
    // PropertyPageMessages.JavaLineBreakpointPage_15);
    // fConditionIsTrue = createRadioButton(conditionComposite,
    // "condition is 'tr&ue'");
    // fConditionHasChanged = createRadioButton(conditionComposite,
    // "value of condition ch&anges");
    // if (breakpoint.isConditionSuspendOnTrue()) {
    // fConditionIsTrue.setSelection(true);
    // } else {
    // fConditionHasChanged.setSelection(true);
    // }
    setConditionEnabled(fEnableConditionButton.getSelection());
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) IErlangBreakpoint(org.erlide.backend.debug.IErlangBreakpoint) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 7 with IErlangBreakpoint

use of org.erlide.backend.debug.IErlangBreakpoint in project erlide_eclipse by erlang.

the class BreakpointMarkerUpdater method lineBreakpointExists.

/**
 * Searches for an existing line breakpoint on the specified line in the current type
 * that does not match the id of the specified marker
 *
 * @param resource
 *            the resource to care about
 * @param typeName
 *            the name of the type the breakpoint is in
 * @param lineNumber
 *            the number of the line the breakpoint is on
 * @param currentmarker
 *            the current marker we are comparing to see if it will be moved onto an
 *            existing one
 * @return an existing line breakpoint on the current line of the given resource and
 *         type if there is one
 * @throws CoreException
 *
 * @since 3.4
 */
private IErlangBreakpoint lineBreakpointExists(final IResource resource, final int lineNumber, final IMarker currentmarker) throws CoreException {
    final IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
    final IBreakpoint[] breakpoints = manager.getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL);
    final String markerType = currentmarker.getType();
    for (final IBreakpoint breakpoint1 : breakpoints) {
        if (!(breakpoint1 instanceof IErlangBreakpoint)) {
            continue;
        }
        final IErlangBreakpoint breakpoint = (IErlangBreakpoint) breakpoint1;
        final IMarker marker = breakpoint.getMarker();
        if (marker != null && marker.exists() && marker.getType().equals(markerType) && currentmarker.getId() != marker.getId()) {
            if (marker instanceof ErlangLineBreakpoint) {
                final ErlangLineBreakpoint erlangLineBreakpoint = (ErlangLineBreakpoint) marker;
                if (erlangLineBreakpoint.getLineNumber() == lineNumber) {
                    return erlangLineBreakpoint;
                }
            }
        }
    }
    return null;
}
Also used : ErlangLineBreakpoint(org.erlide.backend.debug.ErlangLineBreakpoint) IErlangBreakpoint(org.erlide.backend.debug.IErlangBreakpoint) IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) IMarker(org.eclipse.core.resources.IMarker) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

Example 8 with IErlangBreakpoint

use of org.erlide.backend.debug.IErlangBreakpoint in project erlide_eclipse by erlang.

the class ErlangBreakpointPropertyPage method doStore.

/**
 * Stores the values configured in this page. This method should be called from within
 * a workspace runnable to reduce the number of resource deltas.
 */
protected void doStore() throws CoreException {
    final IErlangBreakpoint breakpoint = getBreakpoint();
    // storeHitCount(breakpoint);
    storeEnabled(breakpoint);
    storeBreakAction(breakpoint);
}
Also used : IErlangBreakpoint(org.erlide.backend.debug.IErlangBreakpoint)

Aggregations

IErlangBreakpoint (org.erlide.backend.debug.IErlangBreakpoint)8 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)2 IMarker (org.eclipse.core.resources.IMarker)1 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IBreakpointManager (org.eclipse.debug.core.IBreakpointManager)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 ErlangLineBreakpoint (org.erlide.backend.debug.ErlangLineBreakpoint)1