public RefreshableOnComponent createAdditionalOptionsPanel()

in src/com/intellij/vssSupport/Checkin/VssCheckinEnvironment.java [51:87]


  public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel,
                                                             PairConsumer<Object, Object> additionalDataConsumer)
  {
    VssConfiguration config = VssConfiguration.getInstance( project );
    final CheckinOptions checkinOptions = config.getCheckinOptions();
    final AddOptions addOptions = config.getAddOptions();

    final JPanel additionalPanel = new JPanel();
    additionalPanel.setLayout( new BoxLayout( additionalPanel, BoxLayout.PAGE_AXIS ));
    final JCheckBox keepCheckedOut = new JCheckBox( VssBundle.message("checkbox.option.keep.checked.out") );
    additionalPanel.add( keepCheckedOut );

    //  Add "Store only latest version" is shown only in the case if there is
    //  at least one file with status "ADDED".
    final JCheckBox storeOnlyLatestVersion = new JCheckBox( VssBundle.message("checkbox.option.store.only.latest.version") );
    if( isAnyNewFile( panel.getVirtualFiles() ) )
    {
      additionalPanel.add( storeOnlyLatestVersion );
    }

    return new RefreshableOnComponent()
    {
      public JComponent getComponent() {   return additionalPanel;    }

      public void saveState() {
        addOptions.STORE_ONLY_LATEST_VERSION = storeOnlyLatestVersion.isSelected();
        checkinOptions.KEEP_CHECKED_OUT = addOptions.CHECK_OUT_IMMEDIATELY = keepCheckedOut.isSelected();
      }

      public void restoreState() {  refresh();   }

      public void refresh() {
        storeOnlyLatestVersion.setSelected(addOptions.STORE_ONLY_LATEST_VERSION);
        keepCheckedOut.setSelected(checkinOptions.KEEP_CHECKED_OUT);
      }
    };
  }