use of com.intellij.openapi.fileEditor.ex.FileEditorProviderManager in project intellij-community by JetBrains.
the class StructureViewWrapperImpl method createTempFileEditor.
@Nullable
private FileEditor createTempFileEditor(@NotNull VirtualFile file) {
if (file.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize())
return null;
FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance();
final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file);
return providers.length == 0 ? null : providers[0].createEditor(myProject, file);
}
use of com.intellij.openapi.fileEditor.ex.FileEditorProviderManager in project intellij-community by JetBrains.
the class FileEditorManagerImpl method newEditorComposite.
@Nullable
EditorWithProviderComposite newEditorComposite(final VirtualFile file) {
if (file == null) {
return null;
}
final FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance();
final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file);
if (providers.length == 0)
return null;
final FileEditor[] editors = new FileEditor[providers.length];
for (int i = 0; i < providers.length; i++) {
final FileEditorProvider provider = providers[i];
LOG.assertTrue(provider != null);
LOG.assertTrue(provider.accept(myProject, file));
final FileEditor editor = provider.createEditor(myProject, file);
editors[i] = editor;
LOG.assertTrue(editor.isValid());
editor.addPropertyChangeListener(myEditorPropertyChangeListener);
}
final EditorWithProviderComposite newComposite = new EditorWithProviderComposite(file, editors, providers, this);
final EditorHistoryManager editorHistoryManager = EditorHistoryManager.getInstance(myProject);
for (int i = 0; i < editors.length; i++) {
final FileEditor editor = editors[i];
final FileEditorProvider provider = providers[i];
// Restore myEditor state
FileEditorState state = editorHistoryManager.getState(file, provider);
if (state != null) {
editor.setState(state);
}
}
return newComposite;
}
Aggregations