mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
FileEditorProvider — add default impl of writeState/readState
This commit is contained in:
@@ -18,13 +18,10 @@ package org.intellij.images.editor.impl;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.intellij.images.fileTypes.ImageFileTypeManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -53,21 +50,6 @@ final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
|
||||
return new ImageFileEditorImpl(project, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -68,7 +68,9 @@ public interface FileEditor extends UserDataHolder, Disposable {
|
||||
* @return editor's internal state. Method should never return <code>null</code>.
|
||||
*/
|
||||
@NotNull
|
||||
FileEditorState getState(@NotNull FileEditorStateLevel level);
|
||||
default FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies given state to the editor.
|
||||
@@ -128,5 +130,7 @@ public interface FileEditor extends UserDataHolder, Disposable {
|
||||
FileEditorLocation getCurrentLocation();
|
||||
|
||||
@Nullable
|
||||
StructureViewBuilder getStructureViewBuilder();
|
||||
default StructureViewBuilder getStructureViewBuilder() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -236,11 +236,6 @@ final class TestEditorManagerImpl extends FileEditorManagerEx implements Disposa
|
||||
throw new IncorrectOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +18,7 @@ package com.intellij.openapi.fileEditor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
@@ -46,7 +47,7 @@ public interface FileEditorProvider {
|
||||
|
||||
/**
|
||||
* Creates editor for the specified file. This method
|
||||
* is called only if the provider has accepted this file (i.e. method {@link #accept(Project, VirtualFile)} returned
|
||||
* is called only if the provider has accepted this file (i.e. method {@link #accept(Project, VirtualFile)} returned
|
||||
* <code>true</code>).
|
||||
* The provider should return only valid editor.
|
||||
*
|
||||
@@ -56,27 +57,32 @@ public interface FileEditorProvider {
|
||||
FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file);
|
||||
|
||||
/**
|
||||
* Disposes the specified <code>editor</code>. It is guaranteed that this method is invoked only for editors
|
||||
* Disposes the specified <code>editor</code>. It is guaranteed that this method is invoked only for editors
|
||||
* created with this provider.
|
||||
*
|
||||
* @param editor editor to be disposed. This parameter is always not <code>null</code>.
|
||||
*/
|
||||
void disposeEditor(@NotNull FileEditor editor);
|
||||
default void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize state from the specified <code>sourceElement</code>
|
||||
* Use {@link FileEditorState#INSTANCE} as default implementation
|
||||
*/
|
||||
@NotNull
|
||||
FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file);
|
||||
default FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes state into the specified <code>targetElement</code>
|
||||
*/
|
||||
void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement);
|
||||
default void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of type of the editors that are created with this FileEditorProvider. Each FileEditorProvider should have
|
||||
* @return id of type of the editors that are created with this FileEditorProvider. Each FileEditorProvider should have
|
||||
* unique non null id. The id is used for saving/loading of EditorStates.
|
||||
*/
|
||||
@NotNull @NonNls
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.impl.http.HttpVirtualFile;
|
||||
import org.jdom.Element;
|
||||
@@ -43,21 +42,12 @@ class HttpFileEditorProvider implements FileEditorProvider, DumbAware {
|
||||
return new HttpFileEditor(project, (HttpVirtualFile)file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull final FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull final Element sourceElement, @NotNull final Project project, @NotNull final VirtualFile file) {
|
||||
return new TextEditorState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull final FileEditorState state, @NotNull final Project project, @NotNull final Element targetElement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -20,12 +20,10 @@ import com.intellij.ide.structureView.StructureViewBuilder;
|
||||
import com.intellij.openapi.fileEditor.*;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.SingleRootFileViewProvider;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -47,21 +45,6 @@ public class LargeFileEditorProvider implements FileEditorProvider, DumbAware {
|
||||
return new LargeFileEditor(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element element, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState _state, @NotNull Project project, @NotNull Element element) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -82,11 +81,6 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
return new TextEditorImpl(project, file, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element element, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
@@ -281,9 +275,9 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
TextEditorState.CaretState caretState = state.CARETS[0];
|
||||
LogicalPosition pos = new LogicalPosition(caretState.LINE, caretState.COLUMN);
|
||||
editor.getCaretModel().moveToLogicalPosition(pos);
|
||||
int startOffset = editor.logicalPositionToOffset(new LogicalPosition(caretState.SELECTION_START_LINE,
|
||||
int startOffset = editor.logicalPositionToOffset(new LogicalPosition(caretState.SELECTION_START_LINE,
|
||||
caretState.SELECTION_START_COLUMN));
|
||||
int endOffset = editor.logicalPositionToOffset(new LogicalPosition(caretState.SELECTION_END_LINE,
|
||||
int endOffset = editor.logicalPositionToOffset(new LogicalPosition(caretState.SELECTION_END_LINE,
|
||||
caretState.SELECTION_END_COLUMN));
|
||||
if (startOffset == endOffset) {
|
||||
editor.getSelectionModel().removeSelection();
|
||||
@@ -295,16 +289,14 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
}
|
||||
|
||||
final int relativeCaretPosition = state.RELATIVE_CARET_POSITION;
|
||||
UiNotifyConnector.doWhenFirstShown(editor.getContentComponent(), new Runnable() {
|
||||
public void run() {
|
||||
if (!editor.isDisposed()) {
|
||||
editor.getScrollingModel().disableAnimation();
|
||||
if (relativeCaretPosition != Integer.MAX_VALUE) {
|
||||
EditorUtil.setRelativeCaretPosition(editor, relativeCaretPosition);
|
||||
}
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
editor.getScrollingModel().enableAnimation();
|
||||
UiNotifyConnector.doWhenFirstShown(editor.getContentComponent(), () -> {
|
||||
if (!editor.isDisposed()) {
|
||||
editor.getScrollingModel().disableAnimation();
|
||||
if (relativeCaretPosition != Integer.MAX_VALUE) {
|
||||
EditorUtil.setRelativeCaretPosition(editor, relativeCaretPosition);
|
||||
}
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
editor.getScrollingModel().enableAnimation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -31,7 +31,6 @@ import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -234,16 +233,6 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
|
||||
return "mock";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -93,12 +93,6 @@ public class Mock {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setState(@NotNull FileEditorState state) {
|
||||
}
|
||||
@@ -705,10 +699,6 @@ public class Mock {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,12 +18,9 @@ package org.jetbrains.idea.devkit.testAssistant;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -39,18 +36,6 @@ public class TestDataGroupEditorProvider implements FileEditorProvider, DumbAwar
|
||||
return new TestDataGroupFileEditor(project, (TestDataGroupVirtualFile) file);
|
||||
}
|
||||
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getEditorTypeId() {
|
||||
return "TestDataGroup";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.ide.structureView.StructureViewBuilder;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorLocation;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
|
||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
@@ -63,7 +62,7 @@ public class TestDataGroupFileEditor extends UserDataHolderBase implements FileE
|
||||
splitter.setSecondComponent(wrapWithTitle(myFile.getAfterFile().getName(), myAfterEditor));
|
||||
return splitter;
|
||||
}
|
||||
|
||||
|
||||
private static JComponent wrapWithTitle(String name, final FileEditor beforeEditor) {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
final JLabel label = new JLabel(name);
|
||||
@@ -83,11 +82,6 @@ public class TestDataGroupFileEditor extends UserDataHolderBase implements FileE
|
||||
return myFile.getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
public void setState(@NotNull FileEditorState state) {
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,10 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.fileEditor.*;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorLocation;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
@@ -213,12 +216,6 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
|
||||
myChangeListener.stop();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setState(@NotNull FileEditorState state) {
|
||||
}
|
||||
|
||||
@@ -3,14 +3,11 @@ package org.jetbrains.plugins.javaFX.sceneBuilder;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.javaFX.fxml.JavaFxFileTypeFactory;
|
||||
|
||||
@@ -31,21 +28,6 @@ public class SceneBuilderEditorProvider implements FileEditorProvider, DumbAware
|
||||
return new SceneBuilderEditor(project, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.fileTypes.FileTypeFactory;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
@@ -42,12 +41,7 @@ public class ResourceBundleEditorProvider extends FileTypeFactory implements Fil
|
||||
public boolean accept(@NotNull final Project project, @NotNull final VirtualFile file){
|
||||
if (file instanceof ResourceBundleAsVirtualFile) return true;
|
||||
if (!file.isValid()) return false;
|
||||
PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
|
||||
@Override
|
||||
public PsiFile compute() {
|
||||
return PsiManager.getInstance(project).findFile(file);
|
||||
}
|
||||
});
|
||||
PsiFile psiFile = ApplicationManager.getApplication().runReadAction((Computable<PsiFile>)() -> PsiManager.getInstance(project).findFile(file));
|
||||
PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile);
|
||||
return propertiesFile != null && propertiesFile.getResourceBundle().getPropertiesFiles().size() > 1;
|
||||
}
|
||||
@@ -70,21 +64,12 @@ public class ResourceBundleEditorProvider extends FileTypeFactory implements Fil
|
||||
return new ResourceBundleEditor(resourceBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element element, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return new ResourceBundleEditor.ResourceBundleEditorState(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element element){
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorPolicy getPolicy() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -23,7 +23,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorLocation;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -113,12 +112,6 @@ public class TerminalSessionEditor extends UserDataHolderBase implements FileEdi
|
||||
return myFile.getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setState(@NotNull FileEditorState state) {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,12 +18,9 @@ package org.jetbrains.plugins.terminal.vfs;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -41,22 +38,6 @@ public class TerminalSessionEditorProvider implements FileEditorProvider, DumbAw
|
||||
return new TerminalSessionEditor(project, (TerminalSessionVirtualFileImpl)file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getEditorTypeId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.designer;
|
||||
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.ide.structureView.StructureViewBuilder;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorLocation;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
@@ -117,9 +116,4 @@ public abstract class DesignerEditor extends UserDataHolderBase implements FileE
|
||||
public FileEditorLocation getCurrentLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureViewBuilder getStructureViewBuilder() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -23,7 +23,6 @@ import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -45,20 +44,12 @@ public final class UIFormEditorProvider implements FileEditorProvider {
|
||||
return new UIFormEditor(project, file);
|
||||
}
|
||||
|
||||
public void disposeEditor(@NotNull final FileEditor editor){
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull final Element element, @NotNull final Project project, @NotNull final VirtualFile file){
|
||||
//TODO[anton,vova] implement
|
||||
return new MyEditorState(-1, ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
}
|
||||
|
||||
public void writeState(@NotNull final FileEditorState state, @NotNull final Project project, @NotNull final Element element){
|
||||
//TODO[anton,vova] implement
|
||||
}
|
||||
|
||||
@NotNull public String getEditorTypeId(){
|
||||
return "ui-designer";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -31,11 +30,6 @@ public class IpnbEditorProvider implements FileEditorProvider, DumbAware {
|
||||
return new IpnbFileEditor(project, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -267,12 +267,6 @@ abstract public class PerspectiveFileEditor extends UserDataHolderBase implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState getState(@NotNull FileEditorStateLevel level) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setState(@NotNull FileEditorState state) {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -15,14 +15,10 @@
|
||||
*/
|
||||
package com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileEditor.WeighedFileEditorProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -34,21 +30,6 @@ public abstract class PerspectiveFileEditorProvider extends WeighedFileEditorPro
|
||||
@NotNull
|
||||
public abstract PerspectiveFileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file);
|
||||
|
||||
@Override
|
||||
public void disposeEditor(@NotNull FileEditor editor) {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
|
||||
return FileEditorState.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
|
||||
Reference in New Issue
Block a user