@Override
 public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
   DataContext dataContext = event.getDataContext();
   Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
   if (editor == null) {
     return false;
   }
   final Pair<GutterIconRenderer, Object> pair =
       XBreakpointUtil.findSelectedBreakpoint(project, editor);
   return pair.first != null && pair.second instanceof BreakpointWithHighlighter;
 }
 public void perform(@NotNull final Project project, final AnActionEvent event) {
   Editor editor = event.getData(CommonDataKeys.EDITOR);
   // do not toggle more than once on the same line
   Set<Integer> processedLines = new HashSet<Integer>();
   for (XSourcePosition position :
       XDebuggerUtilImpl.getAllCaretsPositions(project, event.getDataContext())) {
     if (processedLines.add(position.getLine())) {
       XBreakpointUtil.toggleLineBreakpoint(
           project, position.getFile(), editor, position.getLine(), myTemporary, true);
     }
   }
 }
  public void loadProperties() {
    for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
      panel.loadProperties();
    }

    if (myConditionComboBox != null) {
      String condition = myBreakpoint.getCondition();
      myConditionComboBox.setText(condition != null ? condition : "");
    }

    for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
      customPanel.loadFrom(myBreakpoint);
    }
    myEnabledCheckbox.setSelected(myBreakpoint.isEnabled());
    myEnabledCheckbox.setText(XBreakpointUtil.getShortText(myBreakpoint));
  }
  public XLightBreakpointPropertiesPanel(
      Project project, XBreakpointManager breakpointManager, B breakpoint, boolean showAllOptions) {
    myBreakpoint = breakpoint;
    XBreakpointType<B, ?> breakpointType = XBreakpointUtil.getType(breakpoint);

    mySuspendPolicyPanel.init(project, breakpointManager, breakpoint);
    mySuspendPolicyPanel.setDelegate(this);

    mySubPanels.add(mySuspendPolicyPanel);
    myMasterBreakpointPanel.init(project, breakpointManager, breakpoint);
    mySubPanels.add(myMasterBreakpointPanel);
    XDebuggerEditorsProvider debuggerEditorsProvider =
        breakpointType.getEditorsProvider(breakpoint, project);

    myActionsPanel.init(project, breakpointManager, breakpoint, debuggerEditorsProvider);
    mySubPanels.add(myActionsPanel);

    if (debuggerEditorsProvider != null) {
      myConditionComboBox =
          new XDebuggerExpressionComboBox(
              project,
              debuggerEditorsProvider,
              "breakpointCondition",
              myBreakpoint.getSourcePosition());
      JComponent conditionComponent = myConditionComboBox.getComponent();
      myConditionExpressionPanel.add(conditionComponent, BorderLayout.CENTER);
    } else {
      myConditionPanel.setVisible(false);
    }

    myShowMoreOptions = false;
    for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
      if (panel.lightVariant(showAllOptions)) {
        myShowMoreOptions = true;
      }
    }

    myCustomPanels = new ArrayList<XBreakpointCustomPropertiesPanel<B>>();
    XBreakpointCustomPropertiesPanel<B> customPropertiesPanel =
        breakpointType.createCustomPropertiesPanel();
    if (customPropertiesPanel != null) {
      myCustomPropertiesPanelWrapper.add(customPropertiesPanel.getComponent(), BorderLayout.CENTER);
      myCustomPanels.add(customPropertiesPanel);
    }

    XBreakpointCustomPropertiesPanel<B> customConditionPanel =
        breakpointType.createCustomConditionsPanel();
    if (customConditionPanel != null) {
      myCustomConditionsPanelWrapper.add(customConditionPanel.getComponent(), BorderLayout.CENTER);
      myCustomPanels.add(customConditionPanel);
    }

    myMainPanel.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent event) {
            if (myConditionComboBox != null) {
              IdeFocusManager.findInstance()
                  .requestFocus(myConditionComboBox.getComponent(), false);
            }
          }
        });
    myEnabledCheckbox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            myBreakpoint.setEnabled(myEnabledCheckbox.isSelected());
          }
        });
  }
 public String getDisplayText() {
   return XBreakpointUtil.getShortText(myBreakpoint);
 }