use of com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager in project intellij-community by JetBrains.
the class BreakpointManager method doRead.
private void doRead(@NotNull final Element parentNode) {
ApplicationManager.getApplication().runReadAction(() -> {
final Map<String, Breakpoint> nameToBreakpointMap = new THashMap<>();
try {
final List groups = parentNode.getChildren();
for (final Object group1 : groups) {
final Element group = (Element) group1;
if (group.getName().equals(RULES_GROUP_NAME)) {
continue;
}
// skip already converted
if (group.getAttribute(CONVERTED_PARAM) != null) {
continue;
}
final String categoryName = group.getName();
final Key<Breakpoint> breakpointCategory = BreakpointCategory.lookup(categoryName);
final String defaultPolicy = group.getAttributeValue(DEFAULT_SUSPEND_POLICY_ATTRIBUTE_NAME);
final boolean conditionEnabled = Boolean.parseBoolean(group.getAttributeValue(DEFAULT_CONDITION_STATE_ATTRIBUTE_NAME, "true"));
setBreakpointDefaults(breakpointCategory, new BreakpointDefaults(defaultPolicy, conditionEnabled));
Element anyExceptionBreakpointGroup;
if (!AnyExceptionBreakpoint.ANY_EXCEPTION_BREAKPOINT.equals(breakpointCategory)) {
// for compatibility with previous format
anyExceptionBreakpointGroup = group.getChild(AnyExceptionBreakpoint.ANY_EXCEPTION_BREAKPOINT.toString());
//if (factory != null) {
for (Element breakpointNode : group.getChildren("breakpoint")) {
//Breakpoint breakpoint = factory.createBreakpoint(myProject, breakpointNode);
Breakpoint breakpoint = createBreakpoint(categoryName, breakpointNode);
breakpoint.readExternal(breakpointNode);
nameToBreakpointMap.put(breakpoint.getDisplayName(), breakpoint);
}
//}
} else {
anyExceptionBreakpointGroup = group;
}
if (anyExceptionBreakpointGroup != null) {
final Element breakpointElement = group.getChild("breakpoint");
if (breakpointElement != null) {
XBreakpointManager manager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
JavaExceptionBreakpointType type = XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint = manager.getDefaultBreakpoint(type);
Breakpoint breakpoint = getJavaBreakpoint(xBreakpoint);
if (breakpoint != null) {
breakpoint.readExternal(breakpointElement);
addBreakpoint(breakpoint);
}
}
}
}
} catch (InvalidDataException ignored) {
}
final Element rulesGroup = parentNode.getChild(RULES_GROUP_NAME);
if (rulesGroup != null) {
final List<Element> rules = rulesGroup.getChildren("rule");
for (Element rule : rules) {
// skip already converted
if (rule.getAttribute(CONVERTED_PARAM) != null) {
continue;
}
final Element master = rule.getChild(MASTER_BREAKPOINT_TAG_NAME);
if (master == null) {
continue;
}
final Element slave = rule.getChild(SLAVE_BREAKPOINT_TAG_NAME);
if (slave == null) {
continue;
}
final Breakpoint masterBreakpoint = nameToBreakpointMap.get(master.getAttributeValue("name"));
if (masterBreakpoint == null) {
continue;
}
final Breakpoint slaveBreakpoint = nameToBreakpointMap.get(slave.getAttributeValue("name"));
if (slaveBreakpoint == null) {
continue;
}
boolean leaveEnabled = "true".equalsIgnoreCase(rule.getAttributeValue("leaveEnabled"));
XDependentBreakpointManager dependentBreakpointManager = ((XBreakpointManagerImpl) getXBreakpointManager()).getDependentBreakpointManager();
dependentBreakpointManager.setMasterBreakpoint(slaveBreakpoint.myXBreakpoint, masterBreakpoint.myXBreakpoint, leaveEnabled);
//addBreakpointRule(new EnableBreakpointRule(BreakpointManager.this, masterBreakpoint, slaveBreakpoint, leaveEnabled));
}
}
DebuggerInvocationUtil.invokeLater(myProject, this::updateBreakpointsUI);
});
myUIProperties.clear();
final Element props = parentNode.getChild("ui_properties");
if (props != null) {
final List children = props.getChildren("property");
for (Object child : children) {
Element property = (Element) child;
final String name = property.getAttributeValue("name");
final String value = property.getAttributeValue("value");
if (name != null && value != null) {
myUIProperties.put(name, value);
}
}
}
}
Aggregations