diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java index 21ea1e06ff67..122f5efce2eb 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java @@ -229,12 +229,6 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica return false; } - /** @deprecated use {@linkplain #getCanonicalFile()} (to remove in IDEA 12) */ - @Nullable - public VirtualFile getRealFile() { - return isSymLink() ? getCanonicalFile() : this; - } - /** * Resolves all symbolic links containing in a path to this file and returns a path to a link target. * 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 320d2411fe5e..82420a7cb661 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/LocalFileSystem.java @@ -64,12 +64,6 @@ public abstract class LocalFileSystem extends NewVirtualFileSystem { return false; } - /** @deprecated use {@linkplain com.intellij.openapi.vfs.VirtualFile#getCanonicalFile()} (to remove in IDEA 12) */ - @Nullable - public VirtualFile getRealFile(@NotNull final VirtualFile file) { - return file; - } - @Nullable public abstract VirtualFile findFileByIoFile(@NotNull File file); @@ -102,29 +96,34 @@ public abstract class LocalFileSystem extends NewVirtualFileSystem { public abstract void refreshFiles(@NotNull Iterable files, boolean async, boolean recursive, @Nullable Runnable onFinish); - public abstract byte[] physicalContentsToByteArray(@NotNull VirtualFile virtualFile) throws IOException; + /** @deprecated use {@linkplain com.intellij.openapi.vfs.VirtualFile#contentsToByteArray()} (to remove in IDEA 13) */ + @SuppressWarnings({"MethodMayBeStatic", "UnusedDeclaration"}) + public byte[] physicalContentsToByteArray(@NotNull VirtualFile virtualFile) throws IOException{ + return virtualFile.contentsToByteArray(); + } - public abstract long physicalLength(@NotNull VirtualFile virtualFile) throws IOException; + /** @deprecated use {@linkplain VirtualFile#getLength()} (to remove in IDEA 13) */ + @SuppressWarnings({"MethodMayBeStatic", "UnusedDeclaration"}) + public long physicalLength(@NotNull VirtualFile virtualFile) throws IOException{ + return virtualFile.getLength(); + } public interface WatchRequest { @NotNull String getRootPath(); + boolean isToWatchRecursively(); + + /** @deprecated implementation details (to remove in IDEA 13) */ + @SuppressWarnings({"UnusedDeclaration"}) @NotNull String getFileSystemRootPath(); - boolean isToWatchRecursively(); - + /** @deprecated implementation details (to remove in IDEA 13) */ + @SuppressWarnings({"UnusedDeclaration"}) boolean dominates(@NotNull WatchRequest other); } - /** - * Adds this rootFile as the watch root for file system. - * - * @param rootPath path to watch. - * @param toWatchRecursively whether the whole subtree should be monitored. - * @return request handle or null if rootFile does not belong to this file system. - */ @Nullable public abstract WatchRequest addRootToWatch(@NotNull final String rootPath, final boolean toWatchRecursively); diff --git a/platform/platform-impl/src/com/intellij/internal/encodings/ClasspathList.form b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.form similarity index 55% rename from platform/platform-impl/src/com/intellij/internal/encodings/ClasspathList.form rename to platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.form index f63d025861c6..3430e5fb4a92 100644 --- a/platform/platform-impl/src/com/intellij/internal/encodings/ClasspathList.form +++ b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.form @@ -1,27 +1,24 @@
- + - - + - - + - - + @@ -29,24 +26,30 @@ - - + - + - - + - + + + - + - + + + + + + + diff --git a/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java index 6525b612ed90..ae9c9a6841be 100644 --- a/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java +++ b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -21,7 +21,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.LocalFileSystem; import javax.swing.*; import java.awt.event.ActionEvent; @@ -35,8 +34,9 @@ import java.util.Arrays; public class EncodingViewer extends DialogWrapper { private static final Logger LOG = Logger.getInstance("#com.intellij.internal.encodings.EncodingViewer"); + private JPanel myPanel; - private JTextField myText; + private JTextArea myText; private JComboBox myEncoding; private JButton myLoadFile; private byte[] myBytes; @@ -61,8 +61,9 @@ public class EncodingViewer extends DialogWrapper { private void loadFrom(VirtualFile virtualFile) { try { - myBytes = LocalFileSystem.getInstance().physicalContentsToByteArray(virtualFile); - } catch (IOException e) { + myBytes = virtualFile.contentsToByteArray(); + } + catch (IOException e) { LOG.error(e); return; } @@ -74,7 +75,8 @@ public class EncodingViewer extends DialogWrapper { if (myBytes == null || selectedCharset == null) return; try { myText.setText(new String(myBytes, selectedCharset)); - } catch (UnsupportedEncodingException e) { + } + catch (UnsupportedEncodingException e) { LOG.error(e); } } @@ -90,8 +92,9 @@ public class EncodingViewer extends DialogWrapper { myEncoding.setSelectedIndex(defaultIndex); myEncoding.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() != ItemEvent.SELECTED) return; - refreshText(); + if (e.getStateChange() == ItemEvent.SELECTED) { + refreshText(); + } } }); } @@ -99,5 +102,4 @@ public class EncodingViewer extends DialogWrapper { protected JComponent createCenterPanel() { return myPanel; } - } 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 0b839baafafb..5e9fc529ca04 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 @@ -238,10 +238,10 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { protected static boolean isInvalidSymLink(@NotNull final VirtualFile file) { if (!file.isSymLink()) return false; - final VirtualFile realFile = file.getRealFile(); - return realFile == null || - realFile == file || - FileUtil.isAncestor(convertToIOFile(realFile), convertToIOFile(file), true); + final VirtualFile target = file.getCanonicalFile(); + return target == null || + target == file || + FileUtil.isAncestor(convertToIOFile(target), convertToIOFile(file), true); } @Override @@ -316,16 +316,6 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { RefreshQueue.getInstance().refresh(async, recursive, onFinish, VfsUtil.toVirtualFileArray(list)); } - @Override - public byte[] physicalContentsToByteArray(@NotNull final VirtualFile virtualFile) throws IOException { - return virtualFile.contentsToByteArray(); - } - - @Override - public long physicalLength(@NotNull final VirtualFile virtualFile) { - return virtualFile.getLength(); - } - @Override public void registerAuxiliaryFileOperationsHandler(@NotNull LocalFileOperationsHandler handler) { if (myHandlers.contains(handler)) { diff --git a/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java b/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java index 14db11d1cffc..8c96630f68b2 100644 --- a/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java +++ b/platform/testFramework/src/com/intellij/mock/MockLocalFileSystem.java @@ -81,16 +81,6 @@ public class MockLocalFileSystem extends LocalFileSystem { public void refreshFiles(@NotNull Iterable files, boolean async, boolean recursive, @Nullable Runnable onFinish) { } - @Override - public byte[] physicalContentsToByteArray(@NotNull final VirtualFile virtualFile) throws IOException { - throw new UnsupportedOperationException("'physicalContentsToByteArray' not implemented in " + getClass().getName()); - } - - @Override - public long physicalLength(@NotNull final VirtualFile virtualFile) throws IOException { - throw new UnsupportedOperationException("'physicalLength' not implemented in " + getClass().getName()); - } - @Override @Nullable public WatchRequest addRootToWatch(@NotNull final String rootPath, final boolean toWatchRecursively) {