public String getDefaultMessageFor()

in src/net/sourceforge/transparent/Checkin/CCaseCheckinEnvironment.java [91:122]


  public String getDefaultMessageFor( FilePath[] filesToCheckin )
  {
    ClearCase cc = host.getClearCase();
    HashSet<String> commentsPerFile = new HashSet<>();
    for( FilePath path : filesToCheckin )
    {
      //  For ADDED or DELETED files checkout comment has no sence.
      //  While DELETED status is determined indirectly (its VirtualFile is null),
      //  for ADDED we need to ask.
      VirtualFile vfile = path.getVirtualFile();
      if( vfile != null )
      {
        FileStatus status = FileStatusManager.getInstance(project).getStatus( vfile );
        if( status != FileStatus.ADDED )
        {
          String fileComment = cc.getCheckoutComment( new File( path.getPresentableUrl() ) );
          if( StringUtil.isNotEmpty( fileComment ) )
            commentsPerFile.add( fileComment );
        }
      }
    }

    StringBuilder overallComment = new StringBuilder();
    for( String comment : commentsPerFile )
    {
      overallComment.append( comment ).append( "\n-----" );
    }

    //  If Checkout comment is empty - return null, in this case <caller> will
    //  inherit last commit's message for this commit.
    return (overallComment.length() > 0) ? overallComment.toString() : null;
  }