use of com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation in project intellij-community by JetBrains.
the class CvsServicesImpl method getFileContent.
public byte[] getFileContent(Project project, CvsModule cvsFile) throws IOException {
final GetFileContentOperation operation = new GetFileContentOperation(new File(cvsFile.getPathInCvs()), CvsRootConfiguration.createOn(cvsFile.getRepository()), new SimpleRevision(cvsFile.getRevision()));
final CvsOperationExecutor executor = new CvsOperationExecutor(project);
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file.content"), operation, false), CvsOperationExecutorCallback.EMPTY);
if (!executor.hasNoErrors())
throw new RuntimeException(executor.getFirstError());
if (operation.isDeleted())
throw new IOException(CvsBundle.message("exception.text.revision.has.been.deleted"));
return operation.getFileBytes();
}
use of com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation in project intellij-community by JetBrains.
the class CvsServicesImpl method openInEditor.
public void openInEditor(Project project, CvsModule cvsFile) {
CvsRepository repository = cvsFile.getRepository();
RevisionOrDate revisionOrDate = RevisionOrDateImpl.createOn(new DateOrRevisionSettings().updateFrom(repository.getDateOrRevision()));
GetFileContentOperation operation = new GetFileContentOperation(new File(cvsFile.getPathInCvs()), CvsRootConfiguration.createOn(repository), revisionOrDate);
ComparableVcsRevisionOnOperation revision = new ComparableVcsRevisionOnOperation(operation, project);
VcsVirtualFile vcsVirtualFile = new VcsVirtualFile(cvsFile.getPathInCvs(), revision, VcsFileSystem.getInstance());
OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(project, vcsVirtualFile);
FileEditorManager.getInstance(project).openTextEditor(openFileDescriptor, false);
}
use of com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation in project intellij-community by JetBrains.
the class CvsContentRevision method getContentAsBytes.
@Nullable
@Override
public byte[] getContentAsBytes() throws VcsException {
if (myContent == null) {
final GetFileContentOperation operation = new GetFileContentOperation(myFile, myEnvironment, myRevision);
CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file"), operation), CvsOperationExecutorCallback.EMPTY);
CvsResult result = executor.getResult();
if (result.isCanceled()) {
throw new ProcessCanceledException();
}
if (result.hasErrors()) {
throw result.composeError();
}
if (!operation.isLoaded()) {
throw new VcsException("Network problem");
}
myContent = operation.getFileBytes();
}
return myContent;
}
use of com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation in project intellij-community by JetBrains.
the class CvsServicesImpl method createCvsVersionOn.
private static ComparableVcsRevisionOnOperation createCvsVersionOn(CvsModule module, Project project) {
final CvsRootConfiguration rootConfiguration = CvsApplicationLevelConfiguration.getInstance().getConfigurationForCvsRoot(module.getRepository().getStringRepresentation());
CvsConnectionSettings env = new IDEARootFormatter(rootConfiguration).createConfiguration();
GetFileContentOperation operation = new GetFileContentOperation(new File(module.getPathInCvs()), env, new SimpleRevision(module.getRevision()));
return new ComparableVcsRevisionOnOperation(operation, project);
}
Aggregations