Search in sources :

Example 1 with UpdatedFileInfo

use of org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo in project intellij-community by JetBrains.

the class DefaultResponseHandler method processRemovedResponse.

public void processRemovedResponse(String relativeLocalDirectory, String repositoryFilePath, IResponseServices responseServices, IClientEnvironment clientEnvironment) throws IOException {
    final ICvsFileSystem fileSystem = clientEnvironment.getCvsFileSystem();
    final FileObject fileObject = fileSystem.getFileObject(relativeLocalDirectory, repositoryFilePath);
    clientEnvironment.getLocalFileWriter().removeLocalFile(fileObject, fileSystem, clientEnvironment.getFileReadOnlyHandler());
    clientEnvironment.getAdminWriter().removeEntryForFile(fileObject, fileSystem);
    responseServices.getEventSender().notifyFileInfoListeners(new UpdatedFileInfo(fileObject, fileSystem.getLocalFileSystem().getFile(fileObject), UpdatedFileInfo.UpdatedType.REMOVED, null));
}
Also used : UpdatedFileInfo(org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo)

Example 2 with UpdatedFileInfo

use of org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo 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));
}
Also used : UpdatedFileInfo(org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo) Entry(org.netbeans.lib.cvsclient.admin.Entry) Charset(java.nio.charset.Charset) IAdminWriter(org.netbeans.lib.cvsclient.admin.IAdminWriter)

Example 3 with UpdatedFileInfo

use of org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo in project intellij-community by JetBrains.

the class CvsMessagesTranslator method fileInfoGenerated.

public void fileInfoGenerated(Object info) {
    if (info instanceof UpdateFileInfo) {
        final UpdateFileInfo updateFileInfo = (UpdateFileInfo) info;
        final File file = updateFileInfo.getFile();
        if (!myUpdatedFilesManager.fileIsNotUpdated(file) && !myFileToInfoMap.containsKey(file)) {
            myFileToInfoMap.put(file, updateFileInfo);
        }
    } else if (info instanceof UpdatedFileInfo) {
        final UpdatedFileInfo updatedFileInfo = (UpdatedFileInfo) info;
        final File file = updatedFileInfo.getFile();
        if (!myUpdatedFilesManager.fileIsNotUpdated(file)) {
            myFileToInfoMap.put(file, updatedFileInfo);
        }
    }
}
Also used : UpdatedFileInfo(org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo) UpdateFileInfo(org.netbeans.lib.cvsclient.command.update.UpdateFileInfo)

Aggregations

UpdatedFileInfo (org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo)3 Charset (java.nio.charset.Charset)1 Entry (org.netbeans.lib.cvsclient.admin.Entry)1 IAdminWriter (org.netbeans.lib.cvsclient.admin.IAdminWriter)1 UpdateFileInfo (org.netbeans.lib.cvsclient.command.update.UpdateFileInfo)1