@NotNull
  private static WorkingCopyFormat getFormat(@NotNull JRadioButton button) {
    Object format = button.getClientProperty("format");

    return format instanceof WorkingCopyFormat
        ? (WorkingCopyFormat) format
        : WorkingCopyFormat.UNKNOWN;
  }
 @Override
 public void actionPerformed(ActionEvent e) {
   JRadioButton button = ((JRadioButton) e.getSource());
   if (button.isSelected()) {
     ITaskbarList3.TbpFlag flag =
         (ITaskbarList3.TbpFlag) button.getClientProperty(ITaskbarList3.TbpFlag.class);
     list.SetProgressValue((Pointer) hwnd, slider.getValue(), slider.getMaximum());
     list.SetProgressState((Pointer) hwnd, flag);
   }
 }
Example #3
0
 /**
  * Sets the selected strack trace level on the radio buttons. The radio buttons store their stack
  * trace level as a client property and I'll look for a match using that. This way, we don't have
  * to edit this if new levels are created.
  *
  * @param newStackTraceLevel the new stack trace level.
  */
 private void setSelectedStackTraceLevel(ShowStacktrace newStackTraceLevel) {
   Enumeration<AbstractButton> buttonEnumeration = stackTraceButtonGroup.getElements();
   while (buttonEnumeration.hasMoreElements()) {
     JRadioButton radioButton = (JRadioButton) buttonEnumeration.nextElement();
     ShowStacktrace level =
         (ShowStacktrace) radioButton.getClientProperty(STACK_TRACE_LEVEL_CLIENT_PROPERTY);
     if (newStackTraceLevel == level) {
       radioButton.setSelected(true);
       return;
     }
   }
 }
Example #4
0
  /**
   * Returns the currently selected stack trace level. The radio buttons store their stack trace
   * level as a client property so once we get the selected button, we know the level. This way, we
   * don't have to edit this if new levels are created. Unfortunately, Swing doesn't have an easy
   * way to get the actual button from the group.
   *
   * @return the selected stack trace level
   */
  private ShowStacktrace getSelectedStackTraceLevel() {
    ButtonModel selectedButtonModel = stackTraceButtonGroup.getSelection();
    if (selectedButtonModel != null) {
      Enumeration<AbstractButton> buttonEnumeration = stackTraceButtonGroup.getElements();
      while (buttonEnumeration.hasMoreElements()) {
        JRadioButton radioButton = (JRadioButton) buttonEnumeration.nextElement();
        if (radioButton.getModel() == selectedButtonModel) {
          ShowStacktrace level =
              (ShowStacktrace) radioButton.getClientProperty(STACK_TRACE_LEVEL_CLIENT_PROPERTY);
          return level;
        }
      }
    }

    return ShowStacktrace.INTERNAL_EXCEPTIONS;
  }