Java 类com.intellij.util.ui.DialogUtil 实例源码

项目:intellij-ce-playground    文件:UsageViewImpl.java   
private void addButtonRunnable(int index, final Runnable runnable, String text) {
  if (getBorder() == null) setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

  final JButton button = new JButton(UIUtil.replaceMnemonicAmpersand(text));
  DialogUtil.registerMnemonic(button);
  DumbService.getInstance(myProject).makeDumbAware(button, UsageViewImpl.this);

  button.setFocusable(false);
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      runnable.run();
    }
  });

  add(button, index);

  invalidate();
  if (getParent() != null) {
    getParent().validate();
  }
}
项目:intellij-ce-playground    文件:PasswordPromptComponent.java   
public PasswordPromptComponent(PasswordSafeSettings.ProviderType type,
                               String message,
                               boolean showUserName,
                               String passwordPrompt,
                               String rememberPrompt) {
  myIconLabel.setText("");
  myIconLabel.setIcon(Messages.getWarningIcon());
  myMessageLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
  myMessageLabel.setText(message);
  setTargetProviderType(type);
  setUserInputVisible(showUserName);
  if (passwordPrompt != null) myPasswordLabel.setText(passwordPrompt);
  if (rememberPrompt != null) {
    myRememberCheckBox.setText(rememberPrompt);
    DialogUtil.registerMnemonic(myRememberCheckBox);
  }
}
项目:intellij-ce-playground    文件:ResetPasswordComponent.java   
public ResetPasswordComponent(MasterKeyPasswordSafe safe, boolean firstTime) {
  super(safe, firstTime ? "Setup" : "Reset");
  myFirstTime = firstTime;
  UIUtil.setEnabled(myPasswordPanel, false, true);
  myPasswordPanel.setVisible(false);
  if (firstTime) {
    myNewPasswordLabel.setText(myPasswordLabel.getText());
    myNewPasswordLabel.setDisplayedMnemonic(myPasswordLabel.getDisplayedMnemonic());
    myNewPasswordLabel.setDisplayedMnemonicIndex(myPasswordLabel.getDisplayedMnemonicIndex());
    DialogUtil.registerMnemonic(myPasswordLabel, null);
    myPromptLabel.setText("<html><br>Specify the new password for the password database.<br>" +
                          "Leave blank to disable the master password protection.</html>");
  }
  else {
    myPromptLabel.setText("<html><br>The password for the password database will be reset.<br>" +
                          "<b>All previously stored passwords will be removed!</b></html>");
  }
}
项目:tools-idea    文件:UsageViewImpl.java   
public void addButtonRunnable(int index, final Runnable runnable, String text) {
  if (getBorder() == null) setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

  final JButton button = new JButton(UIUtil.replaceMnemonicAmpersand(text));
  DialogUtil.registerMnemonic(button);

  button.setFocusable(false);
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      runnable.run();
    }
  });

  add(button, index);

  invalidate();
  if (getParent() != null) {
    getParent().validate();
  }
}
项目:consulo    文件:MnemonicHelper.java   
@Override
protected void processComponent(Component parentComponent) {
  if (parentComponent instanceof AbstractButton) {
    final AbstractButton abstractButton = ((AbstractButton)parentComponent);
    abstractButton.addPropertyChangeListener(AbstractButton.TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(abstractButton);
    checkForDuplicateMnemonics(abstractButton);
    fixMacMnemonicKeyStroke(abstractButton, null);
  } else if (parentComponent instanceof JLabel) {
    final JLabel jLabel = ((JLabel)parentComponent);
    jLabel.addPropertyChangeListener(TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(jLabel, null);
    checkForDuplicateMnemonics(jLabel);
    fixMacMnemonicKeyStroke(jLabel, "release"); // "release" only is OK for labels
  }
}
项目:consulo    文件:PasswordPromptComponent.java   
public PasswordPromptComponent(PasswordSafeSettings.ProviderType type,
                               String message,
                               boolean showUserName,
                               String passwordPrompt,
                               String rememberPrompt) {
  myIconLabel.setText("");
  myIconLabel.setIcon(Messages.getWarningIcon());
  myMessageLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
  myMessageLabel.setText(message);
  setTargetProviderType(type);
  setUserInputVisible(showUserName);
  if (passwordPrompt != null) myPasswordLabel.setText(passwordPrompt);
  if (rememberPrompt != null) {
    myRememberCheckBox.setText(rememberPrompt);
    DialogUtil.registerMnemonic(myRememberCheckBox);
  }
}
项目:intellij-ce-playground    文件:MnemonicHelper.java   
public void propertyChange(PropertyChangeEvent evt) {
  final Object source = evt.getSource();
  if (source instanceof AbstractButton) {
    DialogUtil.registerMnemonic(((AbstractButton)source));
  } else if (source instanceof JLabel) {
    DialogUtil.registerMnemonic(((JLabel)source), null);
  }
}
项目:intellij-ce-playground    文件:MnemonicHelper.java   
protected void processComponent(Component parentComponent) {
  if (parentComponent instanceof AbstractButton) {
    final AbstractButton abstractButton = ((AbstractButton)parentComponent);
    abstractButton.addPropertyChangeListener(AbstractButton.TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(abstractButton);
    checkForDuplicateMnemonics(abstractButton);
    fixMacMnemonicKeyStroke(abstractButton, null);
  } else if (parentComponent instanceof JLabel) {
    final JLabel jLabel = ((JLabel)parentComponent);
    jLabel.addPropertyChangeListener(TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(jLabel, null);
    checkForDuplicateMnemonics(jLabel);
    fixMacMnemonicKeyStroke(jLabel, "release"); // "release" only is OK for labels
  }
}
项目:intellij-ce-playground    文件:IdeaTitledBorder.java   
public IdeaTitledBorder(String title, int indent, Insets insets) {
  super(title);
  titledSeparator = new TitledSeparator(title);
  titledSeparator.setText(title);
  DialogUtil.registerMnemonic(titledSeparator.getLabel(), null);

  outsideInsets = JBInsets.create(insets);
  insideInsets = new JBInsets(TitledSeparator.BOTTOM_INSET, indent, 0, 0);
}
项目:tools-idea    文件:MnemonicHelper.java   
public void propertyChange(PropertyChangeEvent evt) {
  final Object source = evt.getSource();
  if (source instanceof AbstractButton) {
    DialogUtil.registerMnemonic(((AbstractButton)source));
  } else if (source instanceof JLabel) {
    DialogUtil.registerMnemonic(((JLabel)source), null);
  }
}
项目:tools-idea    文件:MnemonicHelper.java   
protected void processComponent(Component parentComponent) {
  if (parentComponent instanceof AbstractButton) {
    final AbstractButton abstractButton = ((AbstractButton)parentComponent);
    abstractButton.addPropertyChangeListener(AbstractButton.TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(abstractButton);
    checkForDuplicateMnemonics(abstractButton);
  } else if (parentComponent instanceof JLabel) {
    final JLabel jLabel = ((JLabel)parentComponent);
    jLabel.addPropertyChangeListener(TEXT_CHANGED_PROPERTY, TEXT_LISTENER);
    DialogUtil.registerMnemonic(jLabel, null);
    checkForDuplicateMnemonics(jLabel);
    if (SystemInfo.isMac) {
      // hack to make Labels mnemonic work for ALT+KEY_CODE on Macs.
      // Default implementation uses ALT+CTRL+KEY_CODE (see BasicLabelUI).
      final InputMap inputMap = jLabel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
      if (inputMap != null) {
        final KeyStroke[] strokes = inputMap.allKeys();
        if (strokes != null) {
          for (KeyStroke stroke : strokes) {
            final int m = stroke.getModifiers();
            // to be sure if default mnemonic exist
            if (((m & KeyEvent.ALT_MASK) == KeyEvent.ALT_MASK) && ((m & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK)) {
              inputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), KeyEvent.ALT_MASK), "release"); // "release" only is OK
            }
          }
        }
      }
    }
  }
}
项目:tools-idea    文件:IdeaTitledBorder.java   
public IdeaTitledBorder(String title, int indent, Insets insets) {
  super(title);
  titledSeparator = new TitledSeparator(title);
  titledSeparator.setText(title);
  DialogUtil.registerMnemonic(titledSeparator.getLabel(), null);

  this.outsideInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right);

  this.insideInsets = new Insets(TitledSeparator.BOTTOM_INSET, indent, 0, 0);
}
项目:consulo    文件:UsageViewImpl.java   
private void addButtonRunnable(int index, final Runnable runnable, String text) {
  if (getBorder() == null) setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

  final JButton button = new JButton(UIUtil.replaceMnemonicAmpersand(text));
  DialogUtil.registerMnemonic(button);
  getProject().getMessageBus().connect(UsageViewImpl.this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
    @Override
    public void enteredDumbMode() {
      update();
    }

    @Override
    public void exitDumbMode() {
      update();
    }
  });

  button.setFocusable(false);
  button.addActionListener(e -> runnable.run());

  add(button, index);

  invalidate();
  if (getParent() != null) {
    getParent().validate();
  }
}
项目:consulo    文件:MnemonicHelper.java   
@Override
public void propertyChange(PropertyChangeEvent evt) {
  final Object source = evt.getSource();
  if (source instanceof AbstractButton) {
    DialogUtil.registerMnemonic(((AbstractButton)source));
  } else if (source instanceof JLabel) {
    DialogUtil.registerMnemonic(((JLabel)source), null);
  }
}
项目:consulo    文件:IdeaTitledBorder.java   
public IdeaTitledBorder(String title, int indent, Insets insets) {
  super(title);
  titledSeparator = new TitledSeparator(title);
  titledSeparator.setText(title);
  DialogUtil.registerMnemonic(titledSeparator.getLabel(), null);

  outsideInsets = JBInsets.create(insets);
  insideInsets = new JBInsets(TitledSeparator.BOTTOM_INSET, indent, 0, 0);
}
项目:intellij-ce-playground    文件:FieldBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent() {
  JPanel _panel;
  JPanel _panel0;
  myWatchAccessCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.access"));
  myWatchModificationCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.modification"));
  DialogUtil.registerMnemonic(myWatchAccessCheckBox);
  DialogUtil.registerMnemonic(myWatchModificationCheckBox);


  Box watchBox = Box.createVerticalBox();
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchAccessCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchModificationCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);

  _panel = new JPanel(new BorderLayout());
  _panel0 = new JPanel(new BorderLayout());
  _panel0.add(watchBox, BorderLayout.CENTER);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
  _panel.add(_panel0, BorderLayout.NORTH);
  _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      JCheckBox toCheck = null;
      if (!myWatchAccessCheckBox.isSelected() && !myWatchModificationCheckBox.isSelected()) {
        Object source = e.getSource();
        if (myWatchAccessCheckBox.equals(source)) {
          toCheck = myWatchModificationCheckBox;
        }
        else if (myWatchModificationCheckBox.equals(source)) {
          toCheck = myWatchAccessCheckBox;
        }
        if (toCheck != null) {
          toCheck.setSelected(true);
        }
      }
    }
  };
  myWatchAccessCheckBox.addActionListener(listener);
  myWatchModificationCheckBox.addActionListener(listener);

  return _panel;
}
项目:intellij-ce-playground    文件:MethodBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent() {
  JPanel _panel, _panel0;

  myWatchEntryCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.entry"));
  myWatchExitCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.exit"));
  DialogUtil.registerMnemonic(myWatchEntryCheckBox);
  DialogUtil.registerMnemonic(myWatchExitCheckBox);


  Box watchBox = Box.createVerticalBox();
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchEntryCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchExitCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);

  _panel = new JPanel(new BorderLayout());
  _panel0 = new JPanel(new BorderLayout());
  _panel0.add(watchBox, BorderLayout.CENTER);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
  _panel.add(_panel0, BorderLayout.NORTH);
  _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      JCheckBox toCheck = null;
      if (!myWatchEntryCheckBox.isSelected() && !myWatchExitCheckBox.isSelected()) {
        Object source = e.getSource();
        if (myWatchEntryCheckBox.equals(source)) {
          toCheck = myWatchExitCheckBox;
        }
        else if (myWatchExitCheckBox.equals(source)) {
          toCheck = myWatchEntryCheckBox;
        }
        if (toCheck != null) {
          toCheck.setSelected(true);
        }
      }
    }
  };
  myWatchEntryCheckBox.addActionListener(listener);
  myWatchExitCheckBox.addActionListener(listener);

  return _panel;
}
项目:intellij-ce-playground    文件:ExceptionBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent() {
  myNotifyCaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.caught.exception"));
  myNotifyUncaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.uncaught.exception"));
  DialogUtil.registerMnemonic(myNotifyCaughtCheckBox);
  DialogUtil.registerMnemonic(myNotifyUncaughtCheckBox);


  Box notificationsBox = Box.createVerticalBox();
  JPanel _panel = new JPanel(new BorderLayout());
  _panel.add(myNotifyCaughtCheckBox, BorderLayout.NORTH);
  notificationsBox.add(_panel);
  _panel = new JPanel(new BorderLayout());
  _panel.add(myNotifyUncaughtCheckBox, BorderLayout.NORTH);
  notificationsBox.add(_panel);

  _panel = new JPanel(new BorderLayout());
  JPanel _panel0 = new JPanel(new BorderLayout());
  _panel0.add(notificationsBox, BorderLayout.CENTER);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
  _panel.add(_panel0, BorderLayout.NORTH);
  _panel.setBorder(IdeBorderFactory.createTitledBorder(
    DebuggerBundle.message("label.exception.breakpoint.properties.panel.group.notifications"), true));

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (!myNotifyCaughtCheckBox.isSelected() && !myNotifyUncaughtCheckBox.isSelected()) {
        Object source = e.getSource();
        JCheckBox toCheck = null;
        if (myNotifyCaughtCheckBox.equals(source)) {
          toCheck = myNotifyUncaughtCheckBox;
        }
        else if (myNotifyUncaughtCheckBox.equals(source)) {
          toCheck = myNotifyCaughtCheckBox;
        }
        if (toCheck != null) {
          toCheck.setSelected(true);
        }
      }
    }
  };
  myNotifyCaughtCheckBox.addActionListener(listener);
  myNotifyUncaughtCheckBox.addActionListener(listener);
  return _panel;
}
项目:intellij-ce-playground    文件:ExtractMethodDialog.java   
@Nullable
private JPanel createReturnTypePanel() {
  if (TypeConversionUtil.isPrimitiveWrapper(myReturnType) && myNullness == Nullness.NULLABLE) {
    return null;
  }
  final TypeSelectorManagerImpl manager = new TypeSelectorManagerImpl(myProject, myReturnType, findOccurrences(), areTypesDirected()) {
    @Override
    public PsiType[] getTypesForAll(boolean direct) {
      final PsiType[] types = super.getTypesForAll(direct);
      return !isVoidReturn() ? types : ArrayUtil.prepend(PsiType.VOID, types);
    }
  };
  mySelector = manager.getTypeSelector();
  final JComponent component = mySelector.getComponent();
  if (component instanceof JComboBox) {
    if (isVoidReturn()) {
      mySelector.selectType(PsiType.VOID);
    }
    final JPanel returnTypePanel = new JPanel(new BorderLayout(2, 0));
    final JLabel label = new JLabel(RefactoringBundle.message("changeSignature.return.type.prompt"));
    returnTypePanel.add(label, BorderLayout.NORTH);
    returnTypePanel.add(component, BorderLayout.SOUTH);
    DialogUtil.registerMnemonic(label, component);
    ((JComboBox)component).addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        if (myGenerateAnnotations != null) {
          final PsiType selectedType = mySelector.getSelectedType();
          final boolean enabled = PsiUtil.resolveClassInType(selectedType) != null;
          if (!enabled) {
            myGenerateAnnotations.setSelected(false);
          }
          myGenerateAnnotations.setEnabled(enabled);
        }
        updateSignature();
      }
    });
    return returnTypePanel;
  }
  return null;
}
项目:tools-idea    文件:FieldBreakpointPropertiesPanel.java   
protected JComponent createSpecialBox() {
  JPanel _panel;
  JPanel _panel0;
  myWatchAccessCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.access"));
  myWatchModificationCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.modification"));
  DialogUtil.registerMnemonic(myWatchAccessCheckBox);
  DialogUtil.registerMnemonic(myWatchModificationCheckBox);


  Box watchBox = Box.createVerticalBox();
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchAccessCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchModificationCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);

  _panel = new JPanel(new BorderLayout());
  _panel0 = new JPanel(new BorderLayout());
  _panel0.add(watchBox, BorderLayout.CENTER);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
  _panel.add(_panel0, BorderLayout.NORTH);
  _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      JCheckBox toCheck = null;
      if (!myWatchAccessCheckBox.isSelected() && !myWatchModificationCheckBox.isSelected()) {
        Object source = e.getSource();
        if (myWatchAccessCheckBox.equals(source)) {
          toCheck = myWatchModificationCheckBox;
        }
        else if (myWatchModificationCheckBox.equals(source)) {
          toCheck = myWatchAccessCheckBox;
        }
        if (toCheck != null) {
          toCheck.setSelected(true);
        }
      }
    }
  };
  myWatchAccessCheckBox.addActionListener(listener);
  myWatchModificationCheckBox.addActionListener(listener);

  return _panel;
}
项目:tools-idea    文件:MethodBreakpointPropertiesPanel.java   
protected JComponent createSpecialBox() {
  JPanel _panel, _panel0;

  myWatchEntryCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.entry"));
  myWatchExitCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.exit"));
  DialogUtil.registerMnemonic(myWatchEntryCheckBox);
  DialogUtil.registerMnemonic(myWatchExitCheckBox);


  Box watchBox = Box.createVerticalBox();
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchEntryCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);
  _panel = new JPanel(new BorderLayout());
  _panel.add(myWatchExitCheckBox, BorderLayout.NORTH);
  watchBox.add(_panel);

  _panel = new JPanel(new BorderLayout());
  _panel0 = new JPanel(new BorderLayout());
  _panel0.add(watchBox, BorderLayout.CENTER);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
  _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
  _panel.add(_panel0, BorderLayout.NORTH);
  _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      JCheckBox toCheck = null;
      if (!myWatchEntryCheckBox.isSelected() && !myWatchExitCheckBox.isSelected()) {
        Object source = e.getSource();
        if (myWatchEntryCheckBox.equals(source)) {
          toCheck = myWatchExitCheckBox;
        }
        else if (myWatchExitCheckBox.equals(source)) {
          toCheck = myWatchEntryCheckBox;
        }
        if (toCheck != null) {
          toCheck.setSelected(true);
        }
      }
    }
  };
  myWatchEntryCheckBox.addActionListener(listener);
  myWatchExitCheckBox.addActionListener(listener);

  return _panel;
}
项目:tools-idea    文件:ExceptionBreakpointPropertiesPanel.java   
protected JComponent createSpecialBox() {

    myNotifyCaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.caught.exception"));
    myNotifyUncaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.uncaught.exception"));
    DialogUtil.registerMnemonic(myNotifyCaughtCheckBox);
    DialogUtil.registerMnemonic(myNotifyUncaughtCheckBox);


    Box notificationsBox = Box.createVerticalBox();
    JPanel _panel = new JPanel(new BorderLayout());
    _panel.add(myNotifyCaughtCheckBox, BorderLayout.NORTH);
    notificationsBox.add(_panel);
    _panel = new JPanel(new BorderLayout());
    _panel.add(myNotifyUncaughtCheckBox, BorderLayout.NORTH);
    notificationsBox.add(_panel);

    _panel = new JPanel(new BorderLayout());
    JPanel _panel0 = new JPanel(new BorderLayout());
    _panel0.add(notificationsBox, BorderLayout.CENTER);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    _panel.add(_panel0, BorderLayout.NORTH);
    _panel.setBorder(IdeBorderFactory.createTitledBorder(
      DebuggerBundle.message("label.exception.breakpoint.properties.panel.group.notifications"), true));

    ActionListener listener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (!myNotifyCaughtCheckBox.isSelected() && !myNotifyUncaughtCheckBox.isSelected()) {
          Object source = e.getSource();
          JCheckBox toCheck = null;
          if (myNotifyCaughtCheckBox.equals(source)) {
            toCheck = myNotifyUncaughtCheckBox;
          }
          else if (myNotifyUncaughtCheckBox.equals(source)) {
            toCheck = myNotifyCaughtCheckBox;
          }
          if (toCheck != null) {
            toCheck.setSelected(true);
          }
        }
      }
    };
    myNotifyCaughtCheckBox.addActionListener(listener);
    myNotifyUncaughtCheckBox.addActionListener(listener);
    return _panel;
  }
项目:consulo-dotnet    文件:DotNetMethodBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent()
{
    JPanel panel, comboBoxPanel;

    myWatchEntryCheckBox = new JCheckBox("Method entry");
    myWatchExitCheckBox = new JCheckBox("Method exit");
    DialogUtil.registerMnemonic(myWatchEntryCheckBox);
    DialogUtil.registerMnemonic(myWatchExitCheckBox);


    Box watchBox = Box.createVerticalBox();
    panel = new JPanel(new BorderLayout());
    panel.add(myWatchEntryCheckBox, BorderLayout.NORTH);
    watchBox.add(panel);
    panel = new JPanel(new BorderLayout());
    panel.add(myWatchExitCheckBox, BorderLayout.NORTH);
    watchBox.add(panel);

    panel = new JPanel(new BorderLayout());
    comboBoxPanel = new JPanel(new BorderLayout());
    comboBoxPanel.add(watchBox, BorderLayout.CENTER);
    comboBoxPanel.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    comboBoxPanel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    panel.add(comboBoxPanel, BorderLayout.NORTH);
    panel.setBorder(IdeBorderFactory.createTitledBorder("Watch events", true));

    ActionListener listener = new ActionListener()
    {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            JCheckBox toCheck = null;
            if(!myWatchEntryCheckBox.isSelected() && !myWatchExitCheckBox.isSelected())
            {
                Object source = e.getSource();
                if(myWatchEntryCheckBox.equals(source))
                {
                    toCheck = myWatchExitCheckBox;
                }
                else if(myWatchExitCheckBox.equals(source))
                {
                    toCheck = myWatchEntryCheckBox;
                }
                if(toCheck != null)
                {
                    toCheck.setSelected(true);
                }
            }
        }
    };
    myWatchEntryCheckBox.addActionListener(listener);
    myWatchExitCheckBox.addActionListener(listener);

    return panel;
}
项目:consulo-java    文件:ExtractMethodDialog.java   
@Nullable
private JPanel createReturnTypePanel()
{
    if(TypeConversionUtil.isPrimitiveWrapper(myReturnType) && myNullness == Nullness.NULLABLE)
    {
        return null;
    }
    final TypeSelectorManagerImpl manager = new TypeSelectorManagerImpl(myProject, myReturnType, findOccurrences(), areTypesDirected())
    {
        @Override
        public PsiType[] getTypesForAll(boolean direct)
        {
            final PsiType[] types = super.getTypesForAll(direct);
            return !isVoidReturn() ? types : ArrayUtil.prepend(PsiType.VOID, types);
        }
    };
    mySelector = manager.getTypeSelector();
    final JComponent component = mySelector.getComponent();
    if(component instanceof JComboBox)
    {
        if(isVoidReturn())
        {
            mySelector.selectType(PsiType.VOID);
        }
        final JPanel returnTypePanel = new JPanel(new BorderLayout(2, 0));
        final JLabel label = new JLabel(RefactoringBundle.message("changeSignature.return.type.prompt"));
        returnTypePanel.add(label, BorderLayout.NORTH);
        returnTypePanel.add(component, BorderLayout.SOUTH);
        DialogUtil.registerMnemonic(label, component);
        ((JComboBox) component).addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                if(myGenerateAnnotations != null)
                {
                    final PsiType selectedType = mySelector.getSelectedType();
                    final boolean enabled = PsiUtil.resolveClassInType(selectedType) != null;
                    if(!enabled)
                    {
                        myGenerateAnnotations.setSelected(false);
                    }
                    myGenerateAnnotations.setEnabled(enabled);
                }
                updateSignature();
            }
        });
        return returnTypePanel;
    }
    return null;
}
项目:consulo-java    文件:FieldBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent()
{
    JPanel _panel;
    JPanel _panel0;
    myWatchAccessCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.access"));
    myWatchModificationCheckBox = new JCheckBox(DebuggerBundle.message("label.filed.breakpoint.properties.panel.field.modification"));
    DialogUtil.registerMnemonic(myWatchAccessCheckBox);
    DialogUtil.registerMnemonic(myWatchModificationCheckBox);


    Box watchBox = Box.createVerticalBox();
    _panel = new JPanel(new BorderLayout());
    _panel.add(myWatchAccessCheckBox, BorderLayout.NORTH);
    watchBox.add(_panel);
    _panel = new JPanel(new BorderLayout());
    _panel.add(myWatchModificationCheckBox, BorderLayout.NORTH);
    watchBox.add(_panel);

    _panel = new JPanel(new BorderLayout());
    _panel0 = new JPanel(new BorderLayout());
    _panel0.add(watchBox, BorderLayout.CENTER);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    _panel.add(_panel0, BorderLayout.NORTH);
    _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

    ActionListener listener = new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            JCheckBox toCheck = null;
            if(!myWatchAccessCheckBox.isSelected() && !myWatchModificationCheckBox.isSelected())
            {
                Object source = e.getSource();
                if(myWatchAccessCheckBox.equals(source))
                {
                    toCheck = myWatchModificationCheckBox;
                }
                else if(myWatchModificationCheckBox.equals(source))
                {
                    toCheck = myWatchAccessCheckBox;
                }
                if(toCheck != null)
                {
                    toCheck.setSelected(true);
                }
            }
        }
    };
    myWatchAccessCheckBox.addActionListener(listener);
    myWatchModificationCheckBox.addActionListener(listener);

    return _panel;
}
项目:consulo-java    文件:MethodBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent()
{
    JPanel _panel, _panel0;

    myWatchEntryCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.entry"));
    myWatchExitCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.exit"));
    DialogUtil.registerMnemonic(myWatchEntryCheckBox);
    DialogUtil.registerMnemonic(myWatchExitCheckBox);


    Box watchBox = Box.createVerticalBox();
    _panel = new JPanel(new BorderLayout());
    _panel.add(myWatchEntryCheckBox, BorderLayout.NORTH);
    watchBox.add(_panel);
    _panel = new JPanel(new BorderLayout());
    _panel.add(myWatchExitCheckBox, BorderLayout.NORTH);
    watchBox.add(_panel);

    _panel = new JPanel(new BorderLayout());
    _panel0 = new JPanel(new BorderLayout());
    _panel0.add(watchBox, BorderLayout.CENTER);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    _panel.add(_panel0, BorderLayout.NORTH);
    _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.group.watch.events"), true));

    ActionListener listener = new ActionListener()
    {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            JCheckBox toCheck = null;
            if(!myWatchEntryCheckBox.isSelected() && !myWatchExitCheckBox.isSelected())
            {
                Object source = e.getSource();
                if(myWatchEntryCheckBox.equals(source))
                {
                    toCheck = myWatchExitCheckBox;
                }
                else if(myWatchExitCheckBox.equals(source))
                {
                    toCheck = myWatchEntryCheckBox;
                }
                if(toCheck != null)
                {
                    toCheck.setSelected(true);
                }
            }
        }
    };
    myWatchEntryCheckBox.addActionListener(listener);
    myWatchExitCheckBox.addActionListener(listener);

    return _panel;
}
项目:consulo-java    文件:ExceptionBreakpointPropertiesPanel.java   
@NotNull
@Override
public JComponent getComponent()
{
    myNotifyCaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.caught.exception"));
    myNotifyUncaughtCheckBox = new JCheckBox(DebuggerBundle.message("label.exception.breakpoint.properties.panel.uncaught.exception"));
    DialogUtil.registerMnemonic(myNotifyCaughtCheckBox);
    DialogUtil.registerMnemonic(myNotifyUncaughtCheckBox);


    Box notificationsBox = Box.createVerticalBox();
    JPanel _panel = new JPanel(new BorderLayout());
    _panel.add(myNotifyCaughtCheckBox, BorderLayout.NORTH);
    notificationsBox.add(_panel);
    _panel = new JPanel(new BorderLayout());
    _panel.add(myNotifyUncaughtCheckBox, BorderLayout.NORTH);
    notificationsBox.add(_panel);

    _panel = new JPanel(new BorderLayout());
    JPanel _panel0 = new JPanel(new BorderLayout());
    _panel0.add(notificationsBox, BorderLayout.CENTER);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    _panel0.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    _panel.add(_panel0, BorderLayout.NORTH);
    _panel.setBorder(IdeBorderFactory.createTitledBorder(DebuggerBundle.message("label.exception.breakpoint.properties.panel.group.notifications"), true));

    ActionListener listener = new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            if(!myNotifyCaughtCheckBox.isSelected() && !myNotifyUncaughtCheckBox.isSelected())
            {
                Object source = e.getSource();
                JCheckBox toCheck = null;
                if(myNotifyCaughtCheckBox.equals(source))
                {
                    toCheck = myNotifyUncaughtCheckBox;
                }
                else if(myNotifyUncaughtCheckBox.equals(source))
                {
                    toCheck = myNotifyCaughtCheckBox;
                }
                if(toCheck != null)
                {
                    toCheck.setSelected(true);
                }
            }
        }
    };
    myNotifyCaughtCheckBox.addActionListener(listener);
    myNotifyUncaughtCheckBox.addActionListener(listener);
    return _panel;
}