View Javadoc

1   /**
2    * Copyright (C) 2008 Atlassian
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.theplugin.idea.util.memoryvfs;
18  
19  import com.intellij.openapi.components.ApplicationComponent;
20  import com.intellij.openapi.vfs.DeprecatedVirtualFileSystem;
21  import com.intellij.openapi.vfs.VirtualFile;
22  import org.jetbrains.annotations.NonNls;
23  import org.jetbrains.annotations.NotNull;
24  import org.jetbrains.annotations.Nullable;
25  
26  import java.io.IOException;
27  
28  /**
29   * A file system for content that resides only in memory.
30   *
31   * @author Steve Chaloner
32   */
33  public final class PlainTextMemoryVirtualFileSystem extends DeprecatedVirtualFileSystem implements ApplicationComponent {
34      /**
35       * The name of the component.
36       */
37      private static final String COMPONENT_NAME = "PlainText-MemoryFileSystem";
38  
39      @NonNls
40      public String getProtocol() {
41          return Constants.PLAINTEXT_PROTOCOL;
42      }
43  
44      @Nullable
45      public VirtualFile findFileByPath(@NotNull @NonNls String s) {
46          return null;
47      }
48  
49      public void refresh(boolean b) {
50      }
51  
52      @Nullable
53      public VirtualFile refreshAndFindFileByPath(String s) {
54          return null;
55      }
56  
57      protected void deleteFile(Object o, VirtualFile virtualFile) throws IOException {
58          throw new UnsupportedOperationException("method deleteFile not implemented");
59      }
60  
61      protected void moveFile(Object o, VirtualFile virtualFile, VirtualFile virtualFile1) throws IOException {
62          throw new UnsupportedOperationException("method moveFile not implemented");
63      }
64  
65      protected void renameFile(Object o, VirtualFile virtualFile, String s) throws IOException {
66          throw new UnsupportedOperationException("method renameFile not implemented");
67      }
68  
69      protected VirtualFile createChildFile(Object o, VirtualFile virtualFile, String s) throws IOException {
70          throw new UnsupportedOperationException("method createChildFile not implemented");
71      }
72  
73      protected VirtualFile createChildDirectory(Object o, VirtualFile virtualFile, String s) throws IOException {
74          throw new UnsupportedOperationException("method createChildDirectory not implemented");
75      }
76  
77      protected VirtualFile copyFile(Object o, VirtualFile virtualFile, VirtualFile virtualFile1, String s) throws IOException {
78          throw new UnsupportedOperationException("method copyFile not implemented");
79      }
80  
81      private static final PlainTextMemoryVirtualFileSystem INSTANCE = new PlainTextMemoryVirtualFileSystem();
82  
83      public static PlainTextMemoryVirtualFileSystem getInstance() {
84          return INSTANCE;
85      }
86  
87      public void disposeComponent() {
88      }
89  
90      @NonNls
91      @NotNull
92      public String getComponentName() {
93          return COMPONENT_NAME;
94      }
95  
96      public void initComponent() {
97      }
98  }