use of org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties in project intellij-community by JetBrains.
the class JavaLineBreakpointType method getContainingMethod.
@Nullable
public PsiElement getContainingMethod(@NotNull LineBreakpoint<?> breakpoint) {
SourcePosition position = breakpoint.getSourcePosition();
if (position == null)
return null;
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties instanceof JavaLineBreakpointProperties && !(breakpoint instanceof RunToCursorBreakpoint)) {
Integer ordinal = ((JavaLineBreakpointProperties) properties).getLambdaOrdinal();
if (ordinal > -1) {
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
if (ordinal < lambdas.size()) {
return lambdas.get(ordinal);
}
}
}
return DebuggerUtilsEx.getContainingMethod(position);
}
use of org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties in project intellij-community by JetBrains.
the class JavaBreakpointFiltersPanel method loadFrom.
@Override
public void loadFrom(@NotNull B breakpoint) {
myCatchFiltersPanel.setVisible(false);
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
if (properties.getCOUNT_FILTER() > 0) {
myPassCountField.setText(Integer.toString(properties.getCOUNT_FILTER()));
} else {
myPassCountField.setText("");
}
myPassCountCheckbox.setSelected(properties.isCOUNT_FILTER_ENABLED());
myInstanceFiltersCheckBox.setSelected(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFilters = properties.getInstanceFilters();
updateInstanceFilterEditor(true);
myClassFiltersCheckBox.setSelected(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setClassFilters(properties.getClassFilters(), properties.getClassExclusionFilters());
if (properties instanceof JavaExceptionBreakpointProperties) {
myCatchFiltersPanel.setVisible(true);
JavaExceptionBreakpointProperties exceptionBreakpointProperties = (JavaExceptionBreakpointProperties) properties;
myCatchCheckBox.setSelected(exceptionBreakpointProperties.isCatchFiltersEnabled());
myCatchClassFilters.setClassFilters(exceptionBreakpointProperties.getCatchClassFilters(), exceptionBreakpointProperties.getCatchClassExclusionFilters());
}
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
}
updateCheckboxes();
}
use of org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties in project kotlin by JetBrains.
the class KotlinBreakpointFiltersPanel method loadFrom.
@Override
public void loadFrom(@NotNull B breakpoint) {
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
if (properties.getCOUNT_FILTER() > 0) {
myPassCountField.setText(Integer.toString(properties.getCOUNT_FILTER()));
} else {
myPassCountField.setText("");
}
myPassCountCheckbox.setSelected(properties.isCOUNT_FILTER_ENABLED());
myInstanceFiltersCheckBox.setSelected(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.setEnabled(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.getTextField().setEditable(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFilters = properties.getInstanceFilters();
updateInstanceFilterEditor(true);
myClassFiltersCheckBox.setSelected(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setEnabled(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.getTextField().setEditable(properties.isCLASS_FILTERS_ENABLED());
myClassFilters = properties.getClassFilters();
myClassExclusionFilters = properties.getClassExclusionFilters();
updateClassFilterEditor(true);
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
}
updateCheckboxes();
}
use of org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties 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();
}
}
use of org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties in project watchdog by TestRoots.
the class BreakpointCreator method createBreakpoint.
/**
* Factory method that creates and returns a {@link Breakpoint} from a given
* {@link XBreakpoint}.
*/
public static Breakpoint createBreakpoint(XBreakpoint breakpoint) {
Breakpoint result = new Breakpoint(breakpoint.hashCode(), BreakpointClassifier.classify(breakpoint));
// Initialize enabled and SuspendPolicy fields.
result.setEnabled(breakpoint.isEnabled());
result.setSuspendPolicy(breakpoint.getSuspendPolicy().ordinal());
// Initialize hit count field.
result.setHitCount(-1);
if (breakpoint.getProperties() instanceof JavaBreakpointProperties) {
JavaBreakpointProperties properties = (JavaBreakpointProperties) breakpoint.getProperties();
if (properties.isCOUNT_FILTER_ENABLED()) {
result.setHitCount(properties.getCOUNT_FILTER());
}
}
// Initialize condition fields if available.
XExpression condition = breakpoint.getConditionExpression();
if (condition != null) {
result.setCondition(condition.getExpression());
result.setConditionEnabled(true);
}
return result;
}
Aggregations