diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java b/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java index f7f2b659bb7b..5a9163180fab 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java @@ -17,7 +17,6 @@ package com.intellij.openapi.vfs; import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem; import com.intellij.util.Processor; -import com.intellij.util.io.fs.IFile; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,23 +44,9 @@ public abstract class LocalFileSystem extends NewVirtualFileSystem { @Nullable public abstract VirtualFile findFileByIoFile(@NotNull File file); - /** - * @deprecated use {@link #findFileByIoFile(File)} instead - */ - @Deprecated - @Nullable - public abstract VirtualFile findFileByIoFile(@NotNull IFile file); - @Nullable public abstract VirtualFile refreshAndFindFileByIoFile(@NotNull File file); - /** - * @deprecated use {@link #refreshAndFindFileByIoFile(File)} instead - */ - @Deprecated - @Nullable - public abstract VirtualFile refreshAndFindFileByIoFile(@NotNull IFile ioFile); - /** * Performs a non-recursive synchronous refresh of specified files. * diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java index a68454ba2064..14c302cc5f69 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java @@ -36,7 +36,6 @@ import com.intellij.util.Processor; import com.intellij.util.ThrowableConsumer; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.SafeFileOutputStream; -import com.intellij.util.io.fs.IFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,14 +78,6 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { return findFileByPath(path.replace(File.separatorChar, '/')); } - @Override - @Nullable - public VirtualFile findFileByIoFile(@NotNull final IFile file) { - String path = file.getPath(); - if (path == null) return null; - return findFileByPath(path.replace(File.separatorChar, '/')); - } - @NotNull protected static File convertToIOFile(@NotNull final VirtualFile file) { String path = file.getPath(); @@ -240,14 +231,6 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { return refreshAndFindFileByPath(path.replace(File.separatorChar, '/')); } - @Override - @Nullable - public VirtualFile refreshAndFindFileByIoFile(@NotNull final IFile ioFile) { - String path = ioFile.getPath(); - if (path == null) return null; - return refreshAndFindFileByPath(path.replace(File.separatorChar, '/')); - } - @Override public void refreshIoFiles(@NotNull Iterable files) { refreshIoFiles(files, false, false, null); diff --git a/platform/platform-tests/testSrc/com/intellij/mock/MockFileSystem.java b/platform/platform-tests/testSrc/com/intellij/mock/MockFileSystem.java deleted file mode 100644 index a26880fae0cd..000000000000 --- a/platform/platform-tests/testSrc/com/intellij/mock/MockFileSystem.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.intellij.mock; - -import com.intellij.util.io.fs.IFile; -import com.intellij.util.io.fs.IFileSystem; - -import java.io.*; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * @author mike - */ -public class MockFileSystem implements IFileSystem { - private final Set myExistingFiles = new HashSet(); - private final Map myContents = new HashMap(); - - @Override - public IFile createFile(String filePath) { - return new MockFile(filePath); - } - - @Override - public char getSeparatorChar() { - throw new UnsupportedOperationException("Method getSeparatorChar not implemented in " + getClass()); - } - - public class MockFile implements IFile { - private String myPath; - - public MockFile(final String path) { - myPath = path; - } - - public MockFile(final String path, final String content) { - this(path); - myContents.put(path, content); - } - - @Override - public byte[] loadBytes() throws IOException { - throw new UnsupportedOperationException("Method loadBytes not implemented in " + getClass()); - } - - @Override - public InputStream openInputStream() throws FileNotFoundException { - assert exists() : "doesn't exist:" + myPath; - assert myContents.containsKey(myPath) : "content not found:" + myPath; - return new ByteArrayInputStream(myContents.get(myPath).getBytes()); - } - - @Override - public OutputStream openOutputStream() throws FileNotFoundException { - throw new UnsupportedOperationException("Method openOutputStream not implemented in " + getClass()); - } - - @Override - public boolean delete() { - throw new UnsupportedOperationException("Method delete not implemented in " + getClass()); - } - - @Override - public void renameTo(final IFile newFile) throws IOException { - throw new UnsupportedOperationException("Method renameTo not implemented in " + getClass()); - } - - @Override - public void createParentDirs() { - } - - @Override - public IFile getParentFile() { - String parentPath = myPath.substring(0, myPath.lastIndexOf("/")); - return MockFileSystem.this.createFile(parentPath); - } - - @Override - public String getName() { - throw new UnsupportedOperationException("Method getName not implemented in " + getClass()); - } - - @Override - public String getPath() { - return myPath; - } - - @Override - public String getCanonicalPath() { - return getPath(); - } - - @Override - public String getAbsolutePath() { - return myPath; - } - - @Override - public long length() { - assert myContents.containsKey(myPath); - return myContents.get(myPath).getBytes().length; - } - - @Override - public IFile getChild(final String childName) { - assert isDirectory(); - return new MockFile(myPath + "/" + childName); - } - - @Override - public boolean isDirectory() { - return false; - } - - @Override - public boolean exists() { - return myExistingFiles.contains(myPath); - } - - public String toString() { - return "MockFile[" + myPath + "]"; - } - - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final MockFile mockFile = (MockFile)o; - - return myPath.equals(mockFile.myPath); - } - - public int hashCode() { - return myPath.hashCode(); - } - - public MockFile createFile(final String name, final String content) { - String path = myPath + "/" + name; - myExistingFiles.add(path); - return new MockFile(path, content); - } - - - @Override - public IFile[] listFiles() { - throw new UnsupportedOperationException("Method listFiles not implemented in " + getClass()); - } - - @Override - public void mkDir() { - throw new UnsupportedOperationException("Method mkDir not implemented in " + getClass()); - } - - @Override - public long getTimeStamp() { - return 0; - } - } -} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java index a54cea774a90..ac8b2ca440a0 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package com.intellij.openapi.components.impl; import com.intellij.application.options.PathMacrosCollector; import com.intellij.application.options.PathMacrosImpl; import com.intellij.application.options.ReplacePathToMacroMap; -import com.intellij.mock.MockFileSystem; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.PathMacros; @@ -33,8 +32,6 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.SystemProperties; -import com.intellij.util.io.fs.FileSystem; -import com.intellij.util.io.fs.IFileSystem; import org.hamcrest.Description; import org.jetbrains.annotations.Nullable; import org.jmock.Expectations; @@ -109,16 +106,6 @@ public class PathMacroManagerTest { } }); } - - final IFileSystem myOldFileSystem = FileSystem.FILE_SYSTEM; - FileSystem.FILE_SYSTEM = new MockFileSystem(); - - Disposer.register(myRootDisposable, new Disposable() { - @Override - public void dispose() { - FileSystem.FILE_SYSTEM = myOldFileSystem; - } - }); } @After diff --git a/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java b/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java index 1c62d742ddc5..04ac12836403 100644 --- a/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java +++ b/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java @@ -23,7 +23,6 @@ import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; import com.intellij.util.Processor; -import com.intellij.util.io.fs.IFile; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,24 +46,12 @@ public class MockLocalFileSystem extends LocalFileSystem { return myDelegate.findFileByPath(FileUtil.toSystemIndependentName(file.getPath())); } - @Override - @Nullable - public VirtualFile findFileByIoFile(@NotNull final IFile file) { - return myDelegate.findFileByPath(FileUtil.toSystemIndependentName(file.getPath())); - } - @Override @Nullable public VirtualFile refreshAndFindFileByIoFile(@NotNull final File file) { return findFileByIoFile(file); } - @Override - @Nullable - public VirtualFile refreshAndFindFileByIoFile(@NotNull final IFile ioFile) { - return findFileByIoFile(ioFile); - } - @Override public void refreshIoFiles(@NotNull final Iterable files) { } diff --git a/platform/util/src/com/intellij/util/io/fs/FileSystem.java b/platform/util/src/com/intellij/util/io/fs/FileSystem.java deleted file mode 100644 index 212689fb2043..000000000000 --- a/platform/util/src/com/intellij/util/io/fs/FileSystem.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.util.io.fs; - -@Deprecated -public class FileSystem { - public static IFileSystem FILE_SYSTEM = new IoFileSystem(); - - private FileSystem() { - } -} diff --git a/platform/util/src/com/intellij/util/io/fs/IFile.java b/platform/util/src/com/intellij/util/io/fs/IFile.java deleted file mode 100644 index f937cbc2f083..000000000000 --- a/platform/util/src/com/intellij/util/io/fs/IFile.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.util.io.fs; - -import org.jetbrains.annotations.NonNls; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -@Deprecated -public interface IFile { - boolean exists(); - - byte[] loadBytes() throws IOException; - - InputStream openInputStream() throws IOException; - OutputStream openOutputStream() throws FileNotFoundException; - - boolean delete(); - - void renameTo(final IFile newFile) throws IOException; - - void createParentDirs(); - - IFile getParentFile(); - - String getName(); - - String getPath(); - - String getCanonicalPath(); - String getAbsolutePath(); - - long length(); - - IFile getChild(@NonNls final String childName); - - boolean isDirectory(); - - IFile[] listFiles(); - - void mkDir(); - - long getTimeStamp(); -} diff --git a/platform/util/src/com/intellij/util/io/fs/IFileSystem.java b/platform/util/src/com/intellij/util/io/fs/IFileSystem.java deleted file mode 100644 index 33fd833902d7..000000000000 --- a/platform/util/src/com/intellij/util/io/fs/IFileSystem.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.util.io.fs; - -@Deprecated -public interface IFileSystem { - IFile createFile(String filePath); - char getSeparatorChar(); -} diff --git a/platform/util/src/com/intellij/util/io/fs/IoFile.java b/platform/util/src/com/intellij/util/io/fs/IoFile.java deleted file mode 100644 index c9efd0df749d..000000000000 --- a/platform/util/src/com/intellij/util/io/fs/IoFile.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.util.io.fs; - -import com.intellij.openapi.util.SystemInfo; -import com.intellij.openapi.util.io.FileUtil; -import org.jetbrains.annotations.NotNull; - -import java.io.*; - -class IoFile implements IFile { - private final File myFile; - private static final IFile[] EMPTY_ARRAY = new IFile[0]; - - public IoFile(@NotNull final File file) { - myFile = file; - } - - @Override - public boolean exists() { - return myFile.exists(); - } - - @Override - public byte[] loadBytes() throws IOException { - return FileUtil.loadFileBytes(myFile); - } - - @Override - public InputStream openInputStream() throws FileNotFoundException { - return new FileInputStream(myFile); - } - - @Override - public OutputStream openOutputStream() throws FileNotFoundException { - return new FileOutputStream(myFile); - } - - @Override - public boolean delete() { - return myFile.delete(); - } - - @Override - public void renameTo(final IFile newFile) throws IOException { - FileUtil.rename(myFile, ((IoFile)newFile).myFile); - } - - @Override - public void createParentDirs() { - FileUtil.createParentDirs(myFile); - } - - @Override - public IFile getParentFile() { - return new IoFile(myFile.getParentFile()); - } - - @Override - public String getName() { - return myFile.getName(); - } - - @Override - public String getPath() { - return myFile.getPath(); - } - - @Override - public String getCanonicalPath() { - if (SystemInfo.isFileSystemCaseSensitive) { - return myFile.getAbsolutePath(); // fixes problem with symlinks under Unix (however does not under Windows!) - } - else { - try { - return myFile.getCanonicalPath(); - } - catch (IOException e) { - return null; - } - } - } - - @Override - public String getAbsolutePath() { - return myFile.getAbsolutePath(); - } - - @Override - public long length() { - return myFile.length(); - } - - @Override - public IFile getChild(final String childName) { - return new IoFile(new File(myFile, childName)); - } - - @Override - public boolean isDirectory() { - return myFile.isDirectory(); - } - - @Override - public IFile[] listFiles() { - final File[] files = myFile.listFiles(); - if (files == null) return EMPTY_ARRAY; - - IFile[] result = new IoFile[files.length]; - - for (int i = 0; i < result.length; i++) { - result[i] = new IoFile(files[i]); - } - - return result; - } - - @Override - public void mkDir() { - myFile.mkdir(); - } - - @Override - public long getTimeStamp() { - return myFile.lastModified(); - } - - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final IoFile ioFile = (IoFile)o; - - if (!myFile.equals(ioFile.myFile)) return false; - - return true; - } - - public int hashCode() { - return myFile.hashCode(); - } - - public String toString() { - return myFile.toString(); - } -} diff --git a/platform/util/src/com/intellij/util/io/fs/IoFileSystem.java b/platform/util/src/com/intellij/util/io/fs/IoFileSystem.java deleted file mode 100644 index 57ed58149d35..000000000000 --- a/platform/util/src/com/intellij/util/io/fs/IoFileSystem.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.util.io.fs; - -import java.io.File; - -class IoFileSystem implements IFileSystem { - @Override - public IFile createFile(String filePath) { - return new IoFile(new File(filePath)); - } - - @Override - public char getSeparatorChar() { - return File.separatorChar; - } -}