use of org.netbeans.lib.cvsclient.admin.IAdminWriter in project intellij-community by JetBrains.
the class DirectoryPruner method pruneEmptyDirectory.
// Utils ==================================================================
private boolean pruneEmptyDirectory(DirectoryObject directoryObject) throws IOException {
final ILocalFileReader localFileReader = clientEnvironment.getLocalFileReader();
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
final IAdminReader adminReader = clientEnvironment.getAdminReader();
directoriesToScan.remove(directoryObject);
if (!localFileReader.exists(directoryObject, cvsFileSystem)) {
return true;
}
final List fileNames = new ArrayList();
final List directoryNames = new ArrayList();
localFileReader.listFilesAndDirectories(directoryObject, fileNames, directoryNames, cvsFileSystem);
if (fileNames.size() > 0) {
return false;
}
if (hasFileEntry(directoryObject, cvsFileSystem, adminReader)) {
return false;
}
for (Iterator it = directoryNames.iterator(); it.hasNext(); ) {
final String directoryName = (String) it.next();
if (!pruneEmptyDirectory(DirectoryObject.createInstance(directoryObject, directoryName))) {
return false;
}
}
if (adminReader.hasCvsDirectory(directoryObject, cvsFileSystem)) {
try {
adminWriter.removeEntryForFile(directoryObject, cvsFileSystem);
} catch (FileNotFoundException ex) {
// ignore
return false;
}
adminWriter.pruneDirectory(directoryObject, cvsFileSystem);
return true;
}
return false;
}
use of org.netbeans.lib.cvsclient.admin.IAdminWriter in project intellij-community by JetBrains.
the class DefaultResponseHandler method processClearStickyResponse.
public void processClearStickyResponse(String relativeLocalDirectory, String repositoryFilePath, IClientEnvironment clientEnvironment) throws IOException {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final DirectoryObject directoryObject = cvsFileSystem.getDirectoryObject(relativeLocalDirectory, repositoryFilePath);
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
adminWriter.ensureCvsDirectory(directoryObject, repositoryFilePath, clientEnvironment.getCvsRoot(), cvsFileSystem);
adminWriter.setStickyTagForDirectory(directoryObject, null, cvsFileSystem);
}
use of org.netbeans.lib.cvsclient.admin.IAdminWriter in project intellij-community by JetBrains.
the class DefaultResponseHandler method processSetStaticDirectoryResponse.
public void processSetStaticDirectoryResponse(String relativeLocalDirectory, String repositoryFilePath, IResponseServices responseServices, IClientEnvironment clientEnvironment) throws IOException {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final DirectoryObject directoryObject = cvsFileSystem.getDirectoryObject(relativeLocalDirectory, repositoryFilePath);
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
adminWriter.ensureCvsDirectory(directoryObject, repositoryFilePath, clientEnvironment.getCvsRoot(), cvsFileSystem);
adminWriter.setEntriesDotStatic(directoryObject, true, cvsFileSystem);
responseServices.getEventSender().notifyDirectoryListeners(directoryObject, true);
}
use of org.netbeans.lib.cvsclient.admin.IAdminWriter in project intellij-community by JetBrains.
the class DefaultResponseHandler method processClearStaticDirectoryResponse.
public void processClearStaticDirectoryResponse(String relativeLocalDirectory, String repositoryDirectoryPath, IResponseServices responseServices, IClientEnvironment clientEnvironment) throws IOException {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final DirectoryObject directoryObject = cvsFileSystem.getDirectoryObject(relativeLocalDirectory, repositoryDirectoryPath);
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
adminWriter.ensureCvsDirectory(directoryObject, repositoryDirectoryPath, clientEnvironment.getCvsRoot(), cvsFileSystem);
adminWriter.setEntriesDotStatic(directoryObject, false, cvsFileSystem);
responseServices.getEventSender().notifyDirectoryListeners(directoryObject, false);
}
use of org.netbeans.lib.cvsclient.admin.IAdminWriter in project intellij-community by JetBrains.
the class DefaultResponseHandler method processUpdatedMergedResponse.
// Utils ==================================================================
private static void processUpdatedMergedResponse(IClientEnvironment clientEnvironment, String relativeLocalDirectory, String repositoryFilePath, String entryLine, IResponseServices responseServices, String mode, int fileLength, IConnectionStreams connectionStreams, boolean merged) throws IOException {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final FileObject fileObject = cvsFileSystem.getFileObject(relativeLocalDirectory, repositoryFilePath);
final Entry entry = Entry.createEntryForLine(entryLine);
final ILocalFileWriter localFileWriter = clientEnvironment.getLocalFileWriter();
localFileWriter.setNextFileDate(responseServices.getNextFileDate());
// TODO: really???
localFileWriter.setNextFileMode(mode);
final boolean binary = entry.isBinary();
final boolean readOnly = FileUtils.isReadOnlyMode(mode);
final Charset charSet = entry.isUnicode() ? Charset.forName("UTF-16LE") : null;
writeFile(fileObject, fileLength, connectionStreams.getInputStream(), connectionStreams.getReaderFactory(), binary, readOnly, clientEnvironment, charSet);
updateEntriesFileTime(fileObject, entry, cvsFileSystem, merged);
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
adminWriter.ensureCvsDirectory(fileObject.getParent(), repositoryFilePath, clientEnvironment.getCvsRoot(), cvsFileSystem);
adminWriter.setEntry(fileObject.getParent(), entry, cvsFileSystem);
responseServices.getEventSender().notifyEntryListeners(fileObject, entry);
responseServices.getEventSender().notifyFileInfoListeners(new UpdatedFileInfo(fileObject, cvsFileSystem.getLocalFileSystem().getFile(fileObject), merged ? UpdatedFileInfo.UpdatedType.MERGED : UpdatedFileInfo.UpdatedType.UPDATED, entry));
}
Aggregations