public void checkOut()

in src/net/sourceforge/transparent/CommandLineClearCase.java [73:128]


  public void checkOut(File file, boolean isReserved, String comment, boolean noData)
  {
    @NonNls String[] params;
    String canonName;

    try {  canonName = file.getCanonicalPath();  }
    catch (IOException e) {
      canonName = file.getAbsolutePath();
    }

    final List<String> commandLine = new ArrayList<>();
    commandLine.add("co");
    if (StringUtil.isNotEmpty(comment)) {
      commandLine.add("-c");
      commandLine.add(quote(comment));
    } else {
      commandLine.add("-nc");
    }
    commandLine.add(isReserved ? "-reserved" : "-unreserved");
    if (noData) {
      commandLine.add("-ndata");
    }
    commandLine.add("-nq");
    commandLine.add(canonName);

    params = commandLine.toArray(new String[commandLine.size()]);

    Runner runner = cleartool( params, true );
    if( !runner.isSuccessfull() ) {
      boolean isCheckedOut = false;
      try {
        final Status status = getStatus(file);
        isCheckedOut = Status.CHECKED_OUT.equals(status);
      } catch (ClearCaseException e) {
        // ignore and show first exception
      }
      if (! isCheckedOut) {
        throw new ClearCaseException(runner.getOutput());
      }
    }

    String activity = extractActivity( runner.getOutput() );

    //  In the case we did not manage to parse out the activity or we deal with
    //  non-UCM views, do not disturb host.
    if( activity != null && !file.isDirectory() )
    {
      CCaseViewsManager viewsManager = CCaseViewsManager.getInstance( host.getProject() );
      viewsManager.addFile2Changelist( file.getPath(), activity );

      //  If the current activity for a view was changed in the CCase Explorer
      //  and we did not synchronize that in IDEA, we can catch that automatically
      //  by the monitoring the last activity for checked out file.
      viewsManager.checkChangedActivityForView( file.getPath(), activity );
    }
  }