From 0b40c676a573b8e1cea1fce2d49d0c93ff79bc48 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 28 Feb 2014 13:28:33 +0400 Subject: [PATCH] notnull --- .../testFramework/LightVirtualFile.java | 3 ++- .../vfs/impl/jar/CoreJarVirtualFile.java | 9 +++++--- .../openapi/vfs/impl/jar/JarHandlerBase.java | 3 ++- .../vfs/local/CoreLocalVirtualFile.java | 3 ++- .../intellij/dvcs/test/MockVirtualFile.java | 13 +++++------ .../vfs/newvfs/impl/StubVirtualFile.java | 18 ++++++++++++++- .../openapi/vfs/ex/dummy/VirtualFileImpl.java | 4 ++-- .../vfs/impl/http/VirtualFileImpl.java | 1 + .../vfs/newvfs/impl/FakeVirtualFile.java | 3 ++- .../history/integration/TestVirtualFile.java | 7 +++--- .../src/com/intellij/mock/Mock.java | 3 ++- .../com/intellij/mock/MockVirtualFile.java | 4 +++- .../intellij/mock/MockVirtualFileSystem.java | 5 ++-- .../vcs/vfs/AbstractVcsVirtualFile.java | 19 ++++++++++++++- .../TestDataGroupVirtualFile.java | 5 ++-- .../git4idea/tests/SkeletonBuilderTest.java | 3 ++- .../maven/vfs/MavenPropertiesVirtualFile.java | 17 +++++++++++++- .../editor/ResourceBundleAsVirtualFile.java | 23 ++++++++++++++++++- 18 files changed, 113 insertions(+), 30 deletions(-) diff --git a/platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java b/platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java index 158144a369b1..55222cff9448 100644 --- a/platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java +++ b/platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -184,6 +184,7 @@ public class LightVirtualFile extends VirtualFile { return myFileType; } + @NotNull @Override public String getPath() { return "/" + getName(); diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java index 3827ecc2da66..1256c54f3f5d 100644 --- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java +++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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,11 +18,13 @@ package com.intellij.openapi.vfs.impl.jar; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileSystem; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; +import java.util.List; /** * @author yole @@ -30,10 +32,10 @@ import java.util.ArrayList; public class CoreJarVirtualFile extends VirtualFile { private final CoreJarHandler myHandler; private final VirtualFile myParent; - private final ArrayList myChildren = new ArrayList(); + private final List myChildren = new ArrayList(); private final JarHandlerBase.EntryInfo myEntry; - public CoreJarVirtualFile(CoreJarHandler handler, JarHandlerBase.EntryInfo entry, CoreJarVirtualFile parent) { + public CoreJarVirtualFile(@NotNull CoreJarHandler handler, @NotNull JarHandlerBase.EntryInfo entry, @Nullable CoreJarVirtualFile parent) { myHandler = handler; myParent = parent; myEntry = entry; @@ -56,6 +58,7 @@ public class CoreJarVirtualFile extends VirtualFile { } @Override + @NotNull public String getPath() { if (myParent == null) return myHandler.myBasePath + "!/"; diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java index 4dba701485a1..0648e3d319e1 100644 --- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java +++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -52,6 +52,7 @@ public class JarHandlerBase { protected static class EntryInfo { protected final boolean isDirectory; + @NotNull protected final String shortName; protected final EntryInfo parent; diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/local/CoreLocalVirtualFile.java b/platform/core-impl/src/com/intellij/openapi/vfs/local/CoreLocalVirtualFile.java index c3b770af072b..016cab9a818b 100644 --- a/platform/core-impl/src/com/intellij/openapi/vfs/local/CoreLocalVirtualFile.java +++ b/platform/core-impl/src/com/intellij/openapi/vfs/local/CoreLocalVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -56,6 +56,7 @@ public class CoreLocalVirtualFile extends VirtualFile { return myFileSystem; } + @NotNull @Override public String getPath() { return FileUtil.toSystemIndependentName(myIoFile.getAbsolutePath()); diff --git a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVirtualFile.java b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVirtualFile.java index 2b6743c09523..3b36381dcf85 100644 --- a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVirtualFile.java +++ b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -39,9 +39,9 @@ import java.io.OutputStream; */ public class MockVirtualFile extends VirtualFile { - private static VirtualFileSystem ourFileSystem = new MockVirtualFileSystem(); + private static final VirtualFileSystem ourFileSystem = new MockVirtualFileSystem(); - private String myPath; + private final String myPath; @NotNull static VirtualFile fromPath(@NotNull String absolutePath) { @@ -84,6 +84,7 @@ public class MockVirtualFile extends VirtualFile { return ourFileSystem; } + @NotNull @Override public String getPath() { return myPath; @@ -179,14 +180,12 @@ public class MockVirtualFile extends VirtualFile { MockVirtualFile file = (MockVirtualFile)o; - if (myPath != null ? !myPath.equals(file.myPath) : file.myPath != null) return false; - - return true; + return myPath.equals(file.myPath); } @Override public int hashCode() { - return myPath != null ? myPath.hashCode() : 0; + return myPath.hashCode(); } } diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/impl/StubVirtualFile.java b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/impl/StubVirtualFile.java index 48765456e681..7d391758cfdb 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/impl/StubVirtualFile.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/impl/StubVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -30,69 +30,85 @@ import java.io.InputStream; import java.io.OutputStream; public class StubVirtualFile extends VirtualFile { + @Override @NotNull public byte[] contentsToByteArray() throws IOException { throw new UnsupportedOperationException("contentsToByteArray is not implemented"); } + @Override public VirtualFile[] getChildren() { throw new UnsupportedOperationException("getChildren is not implemented"); } + @Override @NotNull public VirtualFileSystem getFileSystem() { throw new UnsupportedOperationException("getFileSystem is not implemented"); } + @Override public InputStream getInputStream() throws IOException { throw new UnsupportedOperationException("getInputStream is not implemented"); } + @Override public long getLength() { throw new UnsupportedOperationException("getLength is not implemented"); } + @Override @NotNull @NonNls public String getName() { throw new UnsupportedOperationException("getName is not implemented"); } + @Override @NotNull public OutputStream getOutputStream(final Object requestor, final long newModificationStamp, final long newTimeStamp) throws IOException { throw new UnsupportedOperationException("getOutputStream is not implemented"); } + @Override @Nullable public VirtualFile getParent() { throw new UnsupportedOperationException("getParent is not implemented"); } + @Override + @NotNull public String getPath() { throw new UnsupportedOperationException("getPath is not implemented"); } + @Override public long getTimeStamp() { throw new UnsupportedOperationException("getTimeStamp is not implemented"); } + @Override @NotNull public String getUrl() { throw new UnsupportedOperationException("getUrl is not implemented"); } + @Override public boolean isDirectory() { throw new UnsupportedOperationException("isDirectory is not implemented"); } + @Override public boolean isValid() { throw new UnsupportedOperationException("isValid is not implemented"); } + @Override public boolean isWritable() { throw new UnsupportedOperationException("isWritable is not implemented"); } + @Override public void refresh(final boolean asynchronous, final boolean recursive, final Runnable postRunnable) { throw new UnsupportedOperationException("refresh is not implemented"); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/VirtualFileImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/VirtualFileImpl.java index 3c1922e29ec8..be96d70a9db3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/VirtualFileImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/dummy/VirtualFileImpl.java @@ -1,6 +1,5 @@ - /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -45,6 +44,7 @@ abstract class VirtualFileImpl extends VirtualFile implements VirtualFileWithId return myFileSystem; } + @NotNull @Override public String getPath() { if (myParent == null) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java index 110d71003867..873ac0200b16 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java @@ -102,6 +102,7 @@ class VirtualFileImpl extends HttpVirtualFile { return myFileSystem; } + @NotNull @Override public String getPath() { return myPath; diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FakeVirtualFile.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FakeVirtualFile.java index 24861243f093..5dc589fa7b66 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FakeVirtualFile.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/FakeVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -38,6 +38,7 @@ public class FakeVirtualFile extends StubVirtualFile { return myParent; } + @NotNull @Override public String getPath() { final String basePath = myParent.getPath(); diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/TestVirtualFile.java b/platform/platform-tests/testSrc/com/intellij/history/integration/TestVirtualFile.java index 990291816e30..44473dfdfe64 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/TestVirtualFile.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/TestVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -33,12 +33,12 @@ import java.util.List; // todo get rid of!!!!!!!!!!!!! public class TestVirtualFile extends VirtualFile { - private String myName; + private final String myName; private String myContent; private boolean isReadOnly; private long myTimestamp; - private boolean IsDirectory; + private final boolean IsDirectory; private VirtualFile myParent; private final List myChildren = new ArrayList(); @@ -76,6 +76,7 @@ public class TestVirtualFile extends VirtualFile { return IsDirectory; } + @NotNull @Override public String getPath() { if (myParent == null) return myName; diff --git a/platform/testFramework/src/com/intellij/mock/Mock.java b/platform/testFramework/src/com/intellij/mock/Mock.java index d511f2fd2d35..f0ca6a19e745 100644 --- a/platform/testFramework/src/com/intellij/mock/Mock.java +++ b/platform/testFramework/src/com/intellij/mock/Mock.java @@ -453,9 +453,10 @@ public class Mock { throw new UnsupportedOperationException(); } + @NotNull @Override public String getPath() { - return null; + throw new UnsupportedOperationException(); } @Override diff --git a/platform/testFramework/src/com/intellij/mock/MockVirtualFile.java b/platform/testFramework/src/com/intellij/mock/MockVirtualFile.java index f6c02f5930ee..9f31bbb9b10f 100644 --- a/platform/testFramework/src/com/intellij/mock/MockVirtualFile.java +++ b/platform/testFramework/src/com/intellij/mock/MockVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -90,6 +90,7 @@ public class MockVirtualFile extends VirtualFile { return ourFileSystem; } + @NotNull @Override public String getPath() { String prefix = myParent == null ? "MOCK_ROOT:" : myParent.getPath(); @@ -101,6 +102,7 @@ public class MockVirtualFile extends VirtualFile { return myIsWritable; } + @Override public void setWritable(boolean b) { myIsWritable = b; } diff --git a/platform/testFramework/src/com/intellij/mock/MockVirtualFileSystem.java b/platform/testFramework/src/com/intellij/mock/MockVirtualFileSystem.java index 2eeee2eb0ac7..19870bfe9b33 100644 --- a/platform/testFramework/src/com/intellij/mock/MockVirtualFileSystem.java +++ b/platform/testFramework/src/com/intellij/mock/MockVirtualFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -113,9 +113,10 @@ public class MockVirtualFileSystem extends DeprecatedVirtualFileSystem { @Override public boolean isDirectory() { - return myChildren.size() != 0; + return !myChildren.isEmpty(); } + @NotNull @Override public String getPath() { final MockVirtualFileSystem.MyVirtualFile parent = getParent(); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java b/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java index 94b7e923fa79..a28564df1722 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/AbstractVcsVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -44,20 +44,25 @@ public abstract class AbstractVcsVirtualFile extends VirtualFile { myParent = null; } + @Override @NotNull public VirtualFileSystem getFileSystem() { return myFileSystem; } + @Override + @NotNull public String getPath() { return myPath; } + @Override @NotNull public String getName() { return myName; } + @Override public String getPresentableName() { if (myRevision == null) return myName; @@ -65,43 +70,53 @@ public abstract class AbstractVcsVirtualFile extends VirtualFile { return myName + " (" + myRevision + ")"; } + @Override public boolean isWritable() { return false; } + @Override public boolean isValid() { return true; } + @Override public VirtualFile getParent() { return myParent; } + @Override public VirtualFile[] getChildren() { return null; } + @Override public InputStream getInputStream() throws IOException { return VfsUtilCore.byteStreamSkippingBOM(contentsToByteArray(), this); } + @Override @NotNull public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException { throw new RuntimeException(VcsFileSystem.COULD_NOT_IMPLEMENT_MESSAGE); } + @Override @NotNull public abstract byte[] contentsToByteArray() throws IOException; + @Override public long getModificationStamp() { return myModificationStamp; } + @Override public long getTimeStamp() { return myModificationStamp; } + @Override public long getLength() { try { return contentsToByteArray().length; @@ -110,6 +125,7 @@ public abstract class AbstractVcsVirtualFile extends VirtualFile { } } + @Override public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { if (postRunnable != null) postRunnable.run(); @@ -123,6 +139,7 @@ public abstract class AbstractVcsVirtualFile extends VirtualFile { myProcessingBeforeContentsChange = true; try { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { ((VcsFileSystem)getFileSystem()).fireBeforeContentsChange(this, AbstractVcsVirtualFile.this); } diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java index c44b49cd71b9..069ef03c8277 100644 --- a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java +++ b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -43,7 +43,7 @@ public class TestDataGroupVirtualFile extends VirtualFile { @Override public String getName() { final String prefix = StringUtil.commonPrefix(myBeforeFile.getName(), myAfterFile.getName()); - if (prefix.length() == 0) { + if (prefix.isEmpty()) { return StringUtil.commonSuffix(myBeforeFile.getName(), myAfterFile.getName()); } return prefix + "." + myBeforeFile.getExtension(); @@ -63,6 +63,7 @@ public class TestDataGroupVirtualFile extends VirtualFile { return LocalFileSystem.getInstance(); } + @NotNull @Override public String getPath() { return myBeforeFile.getPath(); diff --git a/plugins/git4idea/tests/git4idea/tests/SkeletonBuilderTest.java b/plugins/git4idea/tests/git4idea/tests/SkeletonBuilderTest.java index aabf48c54fad..1417a118eacc 100644 --- a/plugins/git4idea/tests/git4idea/tests/SkeletonBuilderTest.java +++ b/plugins/git4idea/tests/git4idea/tests/SkeletonBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -789,6 +789,7 @@ public class SkeletonBuilderTest extends TestCase { return new MockVirtualFileSystem(); } + @NotNull @Override public String getPath() { return "mock"; diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/vfs/MavenPropertiesVirtualFile.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/vfs/MavenPropertiesVirtualFile.java index 7a8ccb550b00..000b855c5ac4 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/vfs/MavenPropertiesVirtualFile.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/vfs/MavenPropertiesVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -52,46 +52,57 @@ public class MavenPropertiesVirtualFile extends VirtualFile { return builder.toString().getBytes(); } + @Override @NotNull public String getName() { return myPath; } + @Override @NotNull public VirtualFileSystem getFileSystem() { return myFS; } + @Override + @NotNull public String getPath() { return myPath; } + @Override public boolean isWritable() { return false; } + @Override public boolean isDirectory() { return false; } + @Override public boolean isValid() { return true; } + @Override public VirtualFile getParent() { return null; } + @Override public VirtualFile[] getChildren() { return null; } + @Override @NotNull public byte[] contentsToByteArray() throws IOException { if (myContent == null) throw new IOException(); return myContent; } + @Override public long getTimeStamp() { return -1; } @@ -101,17 +112,21 @@ public class MavenPropertiesVirtualFile extends VirtualFile { return myContent.hashCode(); } + @Override public long getLength() { return myContent.length; } + @Override public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { } + @Override public InputStream getInputStream() throws IOException { return VfsUtilCore.byteStreamSkippingBOM(myContent,this); } + @Override @NotNull public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException { throw new UnsupportedOperationException(); diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java index 7a48ff9000ba..f61c3b87e80b 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -42,15 +42,19 @@ public class ResourceBundleAsVirtualFile extends VirtualFile { return myResourceBundle; } + @Override @NotNull public VirtualFileSystem getFileSystem() { return LocalFileSystem.getInstance(); } + @Override + @NotNull public String getPath() { return getName(); } + @Override @NotNull public String getName() { return myResourceBundle.getBaseName(); @@ -71,71 +75,88 @@ public class ResourceBundleAsVirtualFile extends VirtualFile { return myResourceBundle.hashCode(); } + @Override public void rename(Object requestor, @NotNull String newName) throws IOException { } + @Override public boolean isWritable() { return true; } + @Override public boolean isDirectory() { return false; } + @Override public boolean isValid() { return true; } + @Override public VirtualFile getParent() { return myResourceBundle.getBaseDirectory(); } + @Override public VirtualFile[] getChildren() { return EMPTY_ARRAY; } + @Override public VirtualFile createChildDirectory(Object requestor, String name) throws IOException { throw new UnsupportedOperationException(); } + @Override public VirtualFile createChildData(Object requestor, @NotNull String name) throws IOException { throw new UnsupportedOperationException(); } + @Override public void delete(Object requestor) throws IOException { //todo } + @Override public void move(Object requestor, @NotNull VirtualFile newParent) throws IOException { //todo } + @Override public InputStream getInputStream() throws IOException { throw new UnsupportedOperationException(); } + @Override @NotNull public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException { throw new UnsupportedOperationException(); } + @Override @NotNull public byte[] contentsToByteArray() throws IOException { throw new UnsupportedOperationException(); } + @Override public long getModificationStamp() { return 0; } + @Override public long getTimeStamp() { return 0; } + @Override public long getLength() { return 0; } + @Override public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { }