use of com.intellij.openapi.fileEditor.TextEditor in project intellij-community by JetBrains.
the class BreadcrumbsInitializingActivity method removeBreadcrumbs.
private static void removeBreadcrumbs(@NotNull FileEditorManager fileEditorManager, @NotNull VirtualFile file) {
final FileEditor[] fileEditors = fileEditorManager.getAllEditors(file);
for (FileEditor fileEditor : fileEditors) {
if (fileEditor instanceof TextEditor) {
Editor editor = ((TextEditor) fileEditor).getEditor();
BreadcrumbsXmlWrapper wrapper = BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor);
if (wrapper != null) {
disposeWrapper(fileEditorManager, fileEditor, wrapper);
}
}
}
}
use of com.intellij.openapi.fileEditor.TextEditor in project intellij-community by JetBrains.
the class XmlTagTreeHighlightingConfigurable method clearTagTreeHighlighting.
private static void clearTagTreeHighlighting() {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
if (fileEditor instanceof TextEditor) {
final Editor editor = ((TextEditor) fileEditor).getEditor();
XmlTagTreeHighlightingPass.clearHighlightingAndLineMarkers(editor, project);
final BreadcrumbsXmlWrapper breadcrumbsXmlWrapper = BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor);
if (breadcrumbsXmlWrapper != null) {
breadcrumbsXmlWrapper.queueUpdate();
}
}
}
}
}
use of com.intellij.openapi.fileEditor.TextEditor in project intellij-plugins by JetBrains.
the class MarkdownActionUtil method findMarkdownTextEditor.
@Nullable
public static Editor findMarkdownTextEditor(AnActionEvent e) {
final SplitFileEditor splitEditor = findSplitEditor(e);
if (splitEditor == null) {
// This fallback is used primarily for testing
final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
if (psiFile != null && psiFile.getLanguage() == MarkdownLanguage.INSTANCE && ApplicationManager.getApplication().isUnitTestMode()) {
return e.getData(CommonDataKeys.EDITOR);
} else {
return null;
}
}
if (!(splitEditor.getMainEditor() instanceof TextEditor)) {
return null;
}
final TextEditor mainEditor = (TextEditor) splitEditor.getMainEditor();
if (!mainEditor.getComponent().isVisible()) {
return null;
}
return mainEditor.getEditor();
}
use of com.intellij.openapi.fileEditor.TextEditor in project oxy-template-support-plugin by mutant-industries.
the class CompiledPreviewUpdater method run.
@Override
public void run() {
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
if (!(fileEditor instanceof TextEditor)) {
continue;
}
EditorEx editor = (EditorEx) ((TextEditor) fileEditor).getEditor();
VirtualFile virtualFile = editor.getVirtualFile();
Language language = virtualFile instanceof LightVirtualFile ? ((LightVirtualFile) virtualFile).getLanguage() : null;
if (language != CompiledPreview.INSTANCE) {
continue;
}
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
PsiFile originalFile;
if (psiFile == null || (originalFile = psiFile.getUserData(CompiledPreviewController.ORIGINAL_FILE_KEY)) == null) {
continue;
}
project.getComponent(CompiledPreviewController.class).showCompiledCode(originalFile, editor.getDocument());
}
}
use of com.intellij.openapi.fileEditor.TextEditor in project psiviewer by cmf.
the class PluginPsiUtil method getEditorIfSelected.
@Nullable
public static Editor getEditorIfSelected(Project project, PsiElement psiElement) {
VirtualFile elementFile = getVirtualFile(project, psiElement);
if (elementFile == null) {
return null;
}
FileEditor fileEditor = FileEditorManager.getInstance(project).getSelectedEditor(elementFile);
Editor editor = null;
if (fileEditor != null && fileEditor instanceof TextEditor) {
editor = ((TextEditor) fileEditor).getEditor();
}
return editor;
}
Aggregations