Search in sources :

Example 1 with XBreakpointBase

use of com.intellij.xdebugger.impl.breakpoints.XBreakpointBase in project intellij-community by JetBrains.

the class Breakpoint method readExternal.

public void readExternal(Element parentNode) throws InvalidDataException {
    FilteredRequestorImpl requestor = new FilteredRequestorImpl(myProject);
    requestor.readTo(parentNode, this);
    try {
        setEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "ENABLED")));
    } catch (Exception ignored) {
    }
    try {
        setLogEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_ENABLED")));
    } catch (Exception ignored) {
    }
    try {
        String logMessage = JDOMExternalizerUtil.readField(parentNode, LOG_MESSAGE_OPTION_NAME);
        if (logMessage != null && !logMessage.isEmpty()) {
            XExpressionImpl expression = XExpressionImpl.fromText(logMessage);
            XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(XBreakpointActionsPanel.LOG_EXPRESSION_HISTORY_ID, expression);
            myXBreakpoint.setLogExpressionObject(expression);
            ((XBreakpointBase) myXBreakpoint).setLogExpressionEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED")));
        }
    } catch (Exception ignored) {
    }
    try {
        setRemoveAfterHit(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "REMOVE_AFTER_HIT")));
    } catch (Exception ignored) {
    }
}
Also used : XExpressionImpl(com.intellij.xdebugger.impl.breakpoints.XExpressionImpl) XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) UnsupportedExpressionException(com.intellij.debugger.engine.evaluation.expression.UnsupportedExpressionException) InvalidDataException(com.intellij.openapi.util.InvalidDataException)

Example 2 with XBreakpointBase

use of com.intellij.xdebugger.impl.breakpoints.XBreakpointBase in project intellij-community by JetBrains.

the class BreakpointManager method getJavaBreakpoint.

@Nullable
public static Breakpoint getJavaBreakpoint(@Nullable final XBreakpoint xBreakpoint) {
    if (xBreakpoint == null) {
        return null;
    }
    Breakpoint breakpoint = xBreakpoint.getUserData(Breakpoint.DATA_KEY);
    if (breakpoint == null && xBreakpoint.getType() instanceof JavaBreakpointType) {
        Project project = ((XBreakpointBase) xBreakpoint).getProject();
        breakpoint = ((JavaBreakpointType) xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint);
        xBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint);
    }
    return breakpoint;
}
Also used : Project(com.intellij.openapi.project.Project) XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with XBreakpointBase

use of com.intellij.xdebugger.impl.breakpoints.XBreakpointBase in project kotlin by JetBrains.

the class KotlinBreakpointFiltersPanel method saveTo.

@Override
public void saveTo(@NotNull B breakpoint) {
    JavaBreakpointProperties properties = breakpoint.getProperties();
    if (properties == null) {
        return;
    }
    boolean changed = false;
    try {
        String text = myPassCountField.getText().trim();
        int filter = !text.isEmpty() ? Integer.parseInt(text) : 0;
        if (filter < 0)
            filter = 0;
        changed = properties.setCOUNT_FILTER(filter);
    } catch (Exception ignored) {
    }
    changed = properties.setCOUNT_FILTER_ENABLED(properties.getCOUNT_FILTER() > 0 && myPassCountCheckbox.isSelected()) || changed;
    reloadInstanceFilters();
    reloadClassFilters();
    updateInstanceFilterEditor(true);
    updateClassFilterEditor(true);
    changed = properties.setINSTANCE_FILTERS_ENABLED(myInstanceFiltersField.getText().length() > 0 && myInstanceFiltersCheckBox.isSelected()) || changed;
    changed = properties.setCLASS_FILTERS_ENABLED(myClassFiltersField.getText().length() > 0 && myClassFiltersCheckBox.isSelected()) || changed;
    changed = properties.setClassFilters(myClassFilters) || changed;
    changed = properties.setClassExclusionFilters(myClassExclusionFilters) || changed;
    changed = properties.setInstanceFilters(myInstanceFilters) || changed;
    if (changed) {
        ((XBreakpointBase) breakpoint).fireBreakpointChanged();
    }
}
Also used : XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) JavaBreakpointProperties(org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint)

Example 4 with XBreakpointBase

use of com.intellij.xdebugger.impl.breakpoints.XBreakpointBase in project google-cloud-intellij by GoogleCloudPlatform.

the class BreakpointConfigurationPanel method saveTo.

@SuppressWarnings("ConstantConditions")
@Override
public void saveTo(@NotNull final XLineBreakpoint<CloudLineBreakpointProperties> ideBreakpoint) {
    CloudLineBreakpointProperties properties = ideBreakpoint.getProperties();
    if (properties == null) {
        LOG.error("Could not save changes to the breakpoint because for some reason it does not have cloud " + "properties.");
        return;
    }
    XBreakpointBase lineBreakpointImpl = ideBreakpoint instanceof XBreakpointBase ? (XBreakpointBase) ideBreakpoint : null;
    if (rootNode != null && lineBreakpointImpl != null) {
        List<String> expressionsToSave = new ArrayList<String>();
        List<? extends WatchNode> children = rootNode.getAllChildren();
        if (children != null) {
            for (WatchNode node : rootNode.getAllChildren()) {
                expressionsToSave.add(node.getExpression().getExpression());
            }
            if (properties.setWatchExpressions(expressionsToSave.toArray(new String[expressionsToSave.size()]))) {
                lineBreakpointImpl.fireBreakpointChanged();
            }
        }
    }
}
Also used : WatchNode(com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode) XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) ArrayList(java.util.ArrayList) CloudLineBreakpointProperties(com.google.cloud.tools.intellij.debugger.CloudLineBreakpointProperties)

Example 5 with XBreakpointBase

use of com.intellij.xdebugger.impl.breakpoints.XBreakpointBase in project intellij-community by JetBrains.

the class JavaBreakpointFiltersPanel method saveTo.

@Override
public void saveTo(@NotNull B breakpoint) {
    JavaBreakpointProperties properties = breakpoint.getProperties();
    if (properties == null) {
        return;
    }
    boolean changed = false;
    try {
        String text = myPassCountField.getText().trim();
        int filter = !text.isEmpty() ? Integer.parseInt(text) : 0;
        if (filter < 0)
            filter = 0;
        changed = properties.setCOUNT_FILTER(filter);
    } catch (Exception ignored) {
    }
    changed = properties.setCOUNT_FILTER_ENABLED(properties.getCOUNT_FILTER() > 0 && myPassCountCheckbox.isSelected()) || changed;
    reloadInstanceFilters();
    updateInstanceFilterEditor(true);
    if (properties instanceof JavaExceptionBreakpointProperties) {
        JavaExceptionBreakpointProperties exceptionBreakpointProperties = (JavaExceptionBreakpointProperties) properties;
        changed = exceptionBreakpointProperties.setCatchFiltersEnabled(!myCatchClassFilters.getText().isEmpty() && myCatchCheckBox.isSelected()) || changed;
        changed = exceptionBreakpointProperties.setCatchClassFilters(myCatchClassFilters.getClassFilters()) || changed;
        changed = exceptionBreakpointProperties.setCatchClassExclusionFilters(myCatchClassFilters.getClassExclusionFilters()) || changed;
    }
    changed = properties.setCLASS_FILTERS_ENABLED(!myClassFiltersField.getText().isEmpty() && myClassFiltersCheckBox.isSelected()) || changed;
    changed = properties.setClassFilters(myClassFiltersField.getClassFilters()) || changed;
    changed = properties.setClassExclusionFilters(myClassFiltersField.getClassExclusionFilters()) || changed;
    changed = properties.setINSTANCE_FILTERS_ENABLED(!myInstanceFiltersField.getText().isEmpty() && myInstanceFiltersCheckBox.isSelected()) || changed;
    changed = properties.setInstanceFilters(myInstanceFilters) || changed;
    if (changed) {
        ((XBreakpointBase) breakpoint).fireBreakpointChanged();
    }
}
Also used : JavaExceptionBreakpointProperties(org.jetbrains.java.debugger.breakpoints.properties.JavaExceptionBreakpointProperties) XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) JavaBreakpointProperties(org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint)

Aggregations

XBreakpointBase (com.intellij.xdebugger.impl.breakpoints.XBreakpointBase)8 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)3 ArrayList (java.util.ArrayList)3 Breakpoint (com.intellij.debugger.ui.breakpoints.Breakpoint)2 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)2 JavaBreakpointProperties (org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties)2 CloudLineBreakpointProperties (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointProperties)1 CloudLineBreakpointType (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType)1 CloudLineBreakpoint (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType.CloudLineBreakpoint)1 UnsupportedExpressionException (com.intellij.debugger.engine.evaluation.expression.UnsupportedExpressionException)1 DocumentImpl (com.intellij.openapi.editor.impl.DocumentImpl)1 Project (com.intellij.openapi.project.Project)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 AnActionButton (com.intellij.ui.AnActionButton)1 AnActionButtonRunnable (com.intellij.ui.AnActionButtonRunnable)1 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)1 CustomLineBorder (com.intellij.ui.border.CustomLineBorder)1 XExpression (com.intellij.xdebugger.XExpression)1 XBreakpointType (com.intellij.xdebugger.breakpoints.XBreakpointType)1 XDebuggerEditorsProvider (com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider)1