Search in sources :

Example 1 with FileReadOnlyHandler

use of com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler in project intellij-community by JetBrains.

the class CvsCommandOperation method createEnvironment.

private IClientEnvironment createEnvironment(IConnection connection, final CvsRootProvider root, UpdatedFilesManager mergedFilesCollector, CvsExecutionEnvironment cvsExecutionEnv) {
    final File localRoot = getLocalRootFor(root);
    final File adminRoot = getAdminRootFor(root);
    LOG.assertTrue(localRoot != null, getClass().getName());
    LOG.assertTrue(adminRoot != null, getClass().getName());
    return new ClientEnvironment(connection, localRoot, adminRoot, root.getCvsRoot(), createLocalFileReader(), createLocalFileWriter(root.getCvsRootAsString(), mergedFilesCollector, cvsExecutionEnv), myAdminReader, myAdminWriter, getIgnoreFileFilter(), new FileReadOnlyHandler(), CvsApplicationLevelConfiguration.getCharset());
}
Also used : FileReadOnlyHandler(com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler) ClientEnvironment(org.netbeans.lib.cvsclient.ClientEnvironment) IClientEnvironment(org.netbeans.lib.cvsclient.IClientEnvironment) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with FileReadOnlyHandler

use of com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler in project intellij-community by JetBrains.

the class CvsFileUtil method storeLines.

public static void storeLines(List<String> lines, File file) throws IOException {
    String separator = getLineSeparatorFor(file);
    FileUtil.createIfDoesntExist(file);
    if (!file.canWrite()) {
        new FileReadOnlyHandler().setFileReadOnly(file, false);
    }
    Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file)), CvsApplicationLevelConfiguration.getCharset());
    try {
        for (final String line : lines) {
            writer.write(line);
            writer.write(separator);
        }
    } finally {
        writer.close();
    }
}
Also used : FileReadOnlyHandler(com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler)

Aggregations

FileReadOnlyHandler (com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 ClientEnvironment (org.netbeans.lib.cvsclient.ClientEnvironment)1 IClientEnvironment (org.netbeans.lib.cvsclient.IClientEnvironment)1