Пример #1
0
 /**
  * Method updateFileVersion
  *
  * @param aTargetFileVer R4EFileVersion
  * @param aSrcFile IFile
  */
 public static void updateFileVersion(R4EFileVersion aTargetFileVer, IFile aSrcFile) {
   if ((null != aTargetFileVer) && (null != aSrcFile)) {
     aTargetFileVer.setName(aSrcFile.getName());
     aTargetFileVer.setRepositoryPath(
         ""); // No repositories for workspace files since they are not in source control
     aTargetFileVer.setResource(aSrcFile);
     aTargetFileVer.setPlatformURI(ResourceUtils.toPlatformURIStr(aSrcFile));
   }
 }
Пример #2
0
 /**
  * Resolve and transfer values from ScmArtifact to R4EFileVersion
  *
  * @param aTargetFileVer R4EFileVersion
  * @param aSourceFileVer R4EFileVersion
  */
 public static void copyFileVersionData(
     R4EFileVersion aTargetFileVer, R4EFileVersion aSourceFileVer) {
   if ((null != aTargetFileVer) && (null != aSourceFileVer)) {
     aTargetFileVer.setName(aSourceFileVer.getName());
     aTargetFileVer.setVersionID(aSourceFileVer.getVersionID());
     aTargetFileVer.setRepositoryPath(aSourceFileVer.getRepositoryPath());
     aTargetFileVer.setLocalVersionID(aSourceFileVer.getLocalVersionID());
     aTargetFileVer.setPlatformURI(aSourceFileVer.getPlatformURI());
     aTargetFileVer.setResource(aSourceFileVer.getResource());
   }
 }
Пример #3
0
  /**
   * Method updateFileVersion
   *
   * @param aTargetFileVer R4EFileVersion
   * @param aScmArt ScmArtifact
   * @throws CoreException
   */
  public static void updateFileVersion(R4EFileVersion aTargetFileVer, ScmArtifact aScmArt)
      throws CoreException {

    if ((null != aTargetFileVer) && (null != aScmArt)) {
      aTargetFileVer.setName(aScmArt.getFileRevision(null).getName());
      aTargetFileVer.setVersionID(aScmArt.getId());
      final IFileRevision fileRev = aScmArt.getFileRevision(null);
      if (null != fileRev) {
        final IStorage fileStore = fileRev.getStorage(null);
        if (null != fileStore) {
          final IPath filePath = fileStore.getFullPath();
          if (null != filePath) {
            aTargetFileVer.setRepositoryPath(filePath.toPortableString());
          }
        }
      }

      final String fileRelPath = aScmArt.getProjectRelativePath();
      if (null == fileRelPath) {
        R4EUIPlugin.Ftracer.traceDebug(
            "Invalid relative file path in scmArtifact with path: " + aScmArt.getPath());
      }
      final IProject project = ResourceUtils.getProject(aScmArt.getProjectName());
      final IResource resource = ResourceUtils.findResource(project, fileRelPath);

      aTargetFileVer.setPlatformURI(ResourceUtils.toPlatformURIStr(resource));
      aTargetFileVer.setResource(resource);

      final String projPlatformURI = ResourceUtils.toPlatformURIStr(project);
      if (null == projPlatformURI) {
        R4EUIPlugin.Ftracer.traceDebug(
            "Unable to resolve the project: "
                + aScmArt.getProjectName()
                + " platform's URI, in scmArtifact with path: "
                + aScmArt.getPath());
      }
    }
  }