private String findActivityForFile()

in src/net/sourceforge/transparent/ChangeManagement/CCaseChangeProvider.java [762:801]


  private String findActivityForFile( FilePath refPath, final FilePath currPath )
  {
    String activity = null;

    //  Computing the activity name (to be used as the Changelist name) is defined
    //  only if the "UCM" mode is checked on for the view. Otherwise IDEA's changelist
    //  preserve their local (IDE-wide) semantics.
    if( mySharedConfig.isUseUcmModel() && myViewManager.isUcmViewForFile( refPath ) )
    {
      //  First check whether the file was checked out under IDEA, we've
      //  parsed the "co" output and extracted the name of the activity under
      //  which the file had been checked out.
      activity = myViewManager.getCheckoutActivityForFile( refPath.getPath() );
      if( activity == null )
      {
        //  Check the changelist which contain this particular file -
        //  if there is no such, then this file (change) is processed for the
        //  very first time and we need to find (or create) the appropriate
        //  change list for it.
        Change change = myChangeListManager.getChange( currPath );
        if( change == null )
        {
          //  Possibly the change had been made outside.
          //  1. Find the view responsible for this file.
          //  2. Take it current activity
          //  3. Find or create a change named after this activity.
          //  4. Remember that this file was first changed in this activity.

          activity = myViewManager.getActivityOfViewOfFile( currPath );

          if( activity == null )
            throw new NullPointerException( "Illegal (NULL) activity name from ViewInfo for an UCM view.");

          myViewManager.addFile2Changelist( refPath.getPath(), activity );
        }
      }
    }

    return activity;
  }