/** * Method useWorkspaceResource. * * @param aVersion R4EFileVersion * @return boolean */ public static boolean useWorkspaceResource(R4EFileVersion aVersion) { // Get handle to local storage repository try { if (null != R4EUIModelController.getActiveReview()) { final IRFSRegistry localRepository = RFSRegistryFactory.getRegistry(R4EUIModelController.getActiveReview().getReview()); if (null != localRepository) { // If resource is available in the workspace, use it. Otherwise use the local repo // version if ((null != aVersion) && (null != aVersion.getResource())) { final String workspaceFileId = localRepository.blobIdFor(((IFile) aVersion.getResource()).getContents()); final String repoFileId = aVersion.getLocalVersionID(); if ((null != workspaceFileId) && workspaceFileId.equals((repoFileId))) { return true; } } } } } catch (ReviewsFileStorageException e) { R4EUIPlugin.Ftracer.traceWarning("Exception: " + e.toString() + " (" + e.getMessage() + ")"); } catch (CoreException e) { R4EUIPlugin.Ftracer.traceWarning("Exception: " + e.toString() + " (" + e.getMessage() + ")"); } return false; }
/** * 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()); } }