public void execute()

in src/com/intellij/vssSupport/commands/UndocheckoutFilesCommand.java [33:89]


  public void execute()
  {
    final UndocheckoutOptions baseOptions = myConfig.getUndocheckoutOptions();
    int savedActionType = baseOptions.REPLACE_LOCAL_COPY;
    boolean replaceInstance = false;

    UndocheckoutListenerNew listener = new UndocheckoutListenerNew( myErrors );
    for( int i = 0; i < myFiles.length; i++ )
    {
      List<String> options = baseOptions.getOptions( myFiles[ i ] );
      String workingPath = myFiles[ i ].getParent().getPath().replace( '/', File.separatorChar );
      listener.setFileName( myFiles[ i ].getPath() );

      // If options specify "ask before replace", Undocheckout runs with -I-N option.
      // This causes replacement of unchanged file but the confirmation is requested
      // for changed files. Analyze output and repeat with proper "Yes" or "No" answer.
      needToAsk = false;

      runProcess( options, workingPath, listener );

      //  Return the option value back - we need to ask again for the next file 
      if( replaceInstance ){
        baseOptions.REPLACE_LOCAL_COPY = savedActionType;
        replaceInstance = false;
      }

      if( needToAsk )
      {
        int exitCode = askOption( myFiles[ i ].getPath() );
        if( exitCode == ConfirmMultipleDialog.YES_EXIT_CODE ){
          replaceInstance = true;
          baseOptions.REPLACE_LOCAL_COPY = UndocheckoutOptions.OPTION_REPLACE;
          //  repeat for the file with the new options set
          i--;
        }
        else
        if( exitCode == ConfirmMultipleDialog.YES_ALL_EXIT_CODE  ){
          baseOptions.REPLACE_LOCAL_COPY = UndocheckoutOptions.OPTION_REPLACE;
          //  repeat for this file and all others with the new options set
          i--;
        }
        else
        if( exitCode == ConfirmMultipleDialog.NO_ALL_EXIT_CODE ){
          baseOptions.REPLACE_LOCAL_COPY = UndocheckoutOptions.OPTION_LEAVE;
        }
        else
        if( exitCode == ConfirmMultipleDialog.CANCEL_OPTION ){
          break;
        }
        // and nothing to do in the case of ConfirmMultipleDialog.NO_EXIT_CODE
      }
    }
    baseOptions.REPLACE_LOCAL_COPY = savedActionType;

    for( VirtualFile file : myFiles )
      file.refresh( true, true );
  }