Usages of

com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Item.downloadFileToTempLocation(?, ?)
@Override protected void doRun(final TFSRepository repository) { final Changeset changeset = (Changeset) getSelectionFirstElement(); final Item item = changeset.getChanges()[0].getItem(); final String localFileName = ServerPath.getFileName(item.getServerItem()); final String localItem = item.downloadFileToTempLocation(repository.getVersionControlClient(), localFileName).getAbsolutePath(); ViewFileHelper.viewLocalFileOrFolder(localItem, site.getPage(), false); }
private String getLocalItemToView(final Change change, final TFSRepository repository) { Item item = change.getItem(); if (ViewVersionType.PREVIOUS == viewVersionType || ViewVersionType.LATEST == viewVersionType) { int version; if (ViewVersionType.PREVIOUS == viewVersionType) { version = item.getChangeSetID() - 1; } else { // Latest version = Integer.MAX_VALUE; } item = repository.getVersionControlClient().getItem(item.getItemID(), version, true); } final String localFileName = ServerPath.getFileName(item.getServerItem()); return item.downloadFileToTempLocation(repository.getVersionControlClient(), localFileName).getAbsolutePath(); }
/** * Download the TFSBuild.proj file specified in the passed {@link Item}, * then attempt to parse it for the values required for the returned * {@link BuildTypeInfo}. * * @param server * the build server (must not be <code>null</code>) * @param item * An {@link Item} representing the TFSBuild.proj file for the build * type. * @return parsed values for the passed AItem. * @throws IOException * if Exception occurred reading or parsing item. */ public static BuildTypeInfo parseBuildTypeFile(final IBuildServer server, final Item item) throws IOException { // Download file to temp location Check.notNull(item, "item"); //$NON-NLS-1$ final String buildTypeName = ServerPath.getFileName(ServerPath.getParent(item.getServerItem())); final String fileName = MessageFormat.format("{0}-{1}", buildTypeName, BuildConstants.PROJECT_FILE_NAME); //$NON-NLS-1$ final File localBuildFile = item.downloadFileToTempLocation(server.getConnection().getVersionControlClient(), fileName); BuildTypeInfo info; try { info = parseBuildTypeInfo(buildTypeName, localBuildFile, item.getEncoding()); } finally { try { localBuildFile.delete(); } catch (final Exception e) { // We did our best, log and ignore. log.error(Messages.getString("BuildTypeUtil.ErrorDeletingTemporaryBuildProjectFile"), e); //$NON-NLS-1$ } TempStorageService.getInstance().cleanUpItem(localBuildFile.getParentFile()); } return info; }
@Override protected void doRun(final TFSRepository repository) { final PendingChange pendingChange = (PendingChange) adaptSelectionFirstElement(PendingChange.class); String localItemToView = pendingChange.getLocalItem(); ViewVersionType thisVersionType = viewVersionType; if (viewVersionType == ViewVersionType.DEFAULT && (localItemToView == null || localItemToView.length() == 0 || pendingChange.getChangeType().contains(ChangeType.DELETE))) { thisVersionType = ViewVersionType.UNMODIFIED; } if (thisVersionType == ViewVersionType.UNMODIFIED || thisVersionType == ViewVersionType.SHELVED) { final String fileName = ServerPath.getFileName(pendingChange.getServerItem()); if (thisVersionType == ViewVersionType.SHELVED) { localItemToView = pendingChange.downloadShelvedFileToTempLocation( repository.getVersionControlClient(), fileName).getAbsolutePath(); } else { localItemToView = pendingChange.downloadBaseFileToTempLocation( repository.getVersionControlClient(), fileName).getAbsolutePath(); } } else if (thisVersionType == ViewVersionType.LATEST) { final Item latestItem = repository.getVersionControlClient().getItem( pendingChange.getServerItem(), LatestVersionSpec.INSTANCE, DeletedState.ANY, GetItemsOptions.DOWNLOAD.combine(GetItemsOptions.INCLUDE_SOURCE_RENAMES)); final String fileName = ServerPath.getFileName(latestItem.getServerItem()); localItemToView = latestItem.downloadFileToTempLocation(repository.getVersionControlClient(), fileName).getAbsolutePath(); } final IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); ViewFileHelper.viewLocalFileOrFolder(localItemToView, workbenchPage, inModalContext); }
protected String getDownloadedFilePath(final IProgressMonitor monitor) throws IOException, InterruptedException { synchronized (downloadedFilePathLock) { if (downloadedFilePath == null) { final Item downloadItem = getDownloadItem(); if (downloadItem.getItemType() == ItemType.FOLDER) { downloadedFilePath = TempStorageService.getInstance().createTempDirectory().getAbsolutePath(); } else { final String messageFormat = Messages.getString("TFSItemCompareNode.DowloadingFileFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, downloadItem.getServerItem()); monitor.setTaskName(message); final String localFileName = ServerPath.getFileName(downloadItem.getServerItem()); downloadedFilePath = downloadItem.downloadFileToTempLocation(vcClient, localFileName).getAbsolutePath(); } } return downloadedFilePath; } }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes