2 * Copyright 2000-2009 JetBrains s.r.o.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package com
.intellij
.openapi
.fileEditor
.impl
.http
;
18 import com
.intellij
.openapi
.fileEditor
.FileEditor
;
19 import com
.intellij
.openapi
.fileEditor
.FileEditorPolicy
;
20 import com
.intellij
.openapi
.fileEditor
.FileEditorProvider
;
21 import com
.intellij
.openapi
.fileEditor
.FileEditorState
;
22 import com
.intellij
.openapi
.fileEditor
.impl
.text
.TextEditorState
;
23 import com
.intellij
.openapi
.project
.DumbAware
;
24 import com
.intellij
.openapi
.project
.Project
;
25 import com
.intellij
.openapi
.util
.Disposer
;
26 import com
.intellij
.openapi
.vfs
.VirtualFile
;
27 import com
.intellij
.openapi
.vfs
.impl
.http
.HttpVirtualFile
;
28 import org
.jdom
.Element
;
29 import org
.jetbrains
.annotations
.NotNull
;
34 public class HttpFileEditorProvider
implements FileEditorProvider
, DumbAware
{
35 public boolean accept(@NotNull final Project project
, @NotNull final VirtualFile file
) {
36 return file
instanceof HttpVirtualFile
&& !file
.isDirectory();
40 public FileEditor
createEditor(@NotNull final Project project
, @NotNull final VirtualFile file
) {
41 return new HttpFileEditor(project
, (HttpVirtualFile
)file
);
44 public void disposeEditor(@NotNull final FileEditor editor
) {
45 Disposer
.dispose(editor
);
49 public FileEditorState
readState(@NotNull final Element sourceElement
, @NotNull final Project project
, @NotNull final VirtualFile file
) {
50 return new TextEditorState();
53 public void writeState(@NotNull final FileEditorState state
, @NotNull final Project project
, @NotNull final Element targetElement
) {
57 public String
getEditorTypeId() {
58 return "httpFileEditor";
62 public FileEditorPolicy
getPolicy() {
63 return FileEditorPolicy
.HIDE_DEFAULT_EDITOR
;