@NotNull public synchronized List<Breakpoint> getBreakpoints() { if (myBreakpointsListForIteration == null) { myBreakpointsListForIteration = new ArrayList<Breakpoint>(myBreakpoints.size()); XBreakpoint<?>[] xBreakpoints = ApplicationManager.getApplication() .runReadAction( new Computable<XBreakpoint<?>[]>() { public XBreakpoint<?>[] compute() { return getXBreakpointManager().getAllBreakpoints(); } }); for (XBreakpoint<?> xBreakpoint : xBreakpoints) { if (isJavaType(xBreakpoint)) { Breakpoint breakpoint = myBreakpoints.get(xBreakpoint); if (breakpoint == null) { breakpoint = createJavaBreakpoint(xBreakpoint); myBreakpoints.put(xBreakpoint, breakpoint); } } } myBreakpointsListForIteration.addAll(myBreakpoints.values()); } return myBreakpointsListForIteration; }
@Nullable public Breakpoint findMasterBreakpoint(@NotNull Breakpoint dependentBreakpoint) { XDependentBreakpointManager dependentBreakpointManager = ((XBreakpointManagerImpl) getXBreakpointManager()).getDependentBreakpointManager(); return myBreakpoints.get( dependentBreakpointManager.getMasterBreakpoint(dependentBreakpoint.myXBreakpoint)); }
// used in Fabrique public synchronized void addBreakpoint(@NotNull Breakpoint breakpoint) { myBreakpoints.put(breakpoint.myXBreakpoint, breakpoint); myBreakpointsListForIteration = null; breakpoint.updateUI(); RequestManagerImpl.createRequests(breakpoint); myDispatcher.getMulticaster().breakpointsChanged(); if (breakpoint instanceof MethodBreakpoint || breakpoint instanceof WildcardMethodBreakpoint) { XDebugSessionImpl.NOTIFICATION_GROUP .createNotification( "Method breakpoints may dramatically slow down debugging", MessageType.WARNING) .notify(myProject); } }
private synchronized void onBreakpointRemoved(@Nullable final XBreakpoint xBreakpoint) { ApplicationManager.getApplication().assertIsDispatchThread(); if (xBreakpoint == null) { return; } Breakpoint breakpoint = myBreakpoints.remove(xBreakpoint); if (breakpoint != null) { // updateBreakpointRules(breakpoint); myBreakpointsListForIteration = null; // we delete breakpoints inside release, so gutter will not fire events to deleted breakpoints breakpoint.delete(); RequestManagerImpl.deleteRequests(breakpoint); myDispatcher.getMulticaster().breakpointsChanged(); } }
private Breakpoint createBreakpoint(String category, Element breakpointNode) throws InvalidDataException { XBreakpoint xBreakpoint = null; if (category.equals(LineBreakpoint.CATEGORY.toString())) { xBreakpoint = createXLineBreakpoint(JavaLineBreakpointType.class, breakpointNode); } else if (category.equals(MethodBreakpoint.CATEGORY.toString())) { if (breakpointNode.getAttribute("url") != null) { xBreakpoint = createXLineBreakpoint(JavaMethodBreakpointType.class, breakpointNode); } else { xBreakpoint = createXBreakpoint(JavaWildcardMethodBreakpointType.class, breakpointNode); } } else if (category.equals(FieldBreakpoint.CATEGORY.toString())) { xBreakpoint = createXLineBreakpoint(JavaFieldBreakpointType.class, breakpointNode); } else if (category.equals(ExceptionBreakpoint.CATEGORY.toString())) { xBreakpoint = createXBreakpoint(JavaExceptionBreakpointType.class, breakpointNode); } if (xBreakpoint == null) { throw new IllegalStateException("Unknown breakpoint category " + category); } return myBreakpoints.get(xBreakpoint); }
private void doRead(@NotNull final Element parentNode) { ApplicationManager.getApplication() .runReadAction( new Runnable() { @Override @SuppressWarnings({"HardCodedStringLiteral"}) public void run() { final Map<String, Breakpoint> nameToBreakpointMap = new THashMap<String, Breakpoint>(); 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()); // final BreakpointFactory factory = // BreakpointFactory.getInstance(breakpointCategory); // 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 = (JavaExceptionBreakpointType) XDebuggerUtil.getInstance() .findBreakpointType(JavaExceptionBreakpointType.class); XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint = manager.getDefaultBreakpoint(type); Breakpoint breakpoint = createJavaBreakpoint(xBreakpoint); 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_TAGNAME); if (master == null) { continue; } final Element slave = rule.getChild(SLAVE_BREAKPOINT_TAGNAME); 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, new Runnable() { @Override public void run() { 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); } } } }
public String setProperty(String name, String value) { return myUIProperties.put(name, value); }
public String getProperty(String name) { return myUIProperties.get(name); }