use of com.intellij.openapi.fileEditor.FileEditorManager in project intellij-community by JetBrains.
the class EditSourceInNewWindowAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
final FileEditorManager manager = FileEditorManager.getInstance(project);
((FileEditorManagerImpl) manager).openFileInNewWindow(getVirtualFiles(e)[0]);
}
use of com.intellij.openapi.fileEditor.FileEditorManager in project intellij-community by JetBrains.
the class HighlightUtils method highlightElements.
public static void highlightElements(@NotNull final Collection<? extends PsiElement> elementCollection) {
if (elementCollection.isEmpty()) {
return;
}
if (elementCollection.contains(null)) {
throw new IllegalArgumentException("Nulls passed in collection: " + elementCollection);
}
final Application application = ApplicationManager.getApplication();
application.invokeLater(() -> {
final PsiElement[] elements = PsiUtilCore.toPsiElementArray(elementCollection);
final PsiElement firstElement = elements[0];
if (ContainerUtil.exists(elements, element -> !element.isValid())) {
return;
}
final Project project = firstElement.getProject();
if (project.isDisposed())
return;
final FileEditorManager editorManager = FileEditorManager.getInstance(project);
final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance();
final Editor editor = editorManager.getSelectedTextEditor();
if (editor == null) {
return;
}
final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme();
final TextAttributes textattributes = globalScheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
final HighlightManager highlightManager = HighlightManager.getInstance(project);
highlightManager.addOccurrenceHighlights(editor, elements, textattributes, true, null);
final WindowManager windowManager = WindowManager.getInstance();
final StatusBar statusBar = windowManager.getStatusBar(project);
statusBar.setInfo(InspectionGadgetsBundle.message("press.escape.to.remove.highlighting.message"));
final FindManager findmanager = FindManager.getInstance(project);
FindModel findmodel = findmanager.getFindNextModel();
if (findmodel == null) {
findmodel = findmanager.getFindInFileModel();
}
findmodel.setSearchHighlighters(true);
findmanager.setFindWasPerformed();
findmanager.setFindNextModel(findmodel);
});
}
use of com.intellij.openapi.fileEditor.FileEditorManager in project intellij-community by JetBrains.
the class OpenFilesActivity method runActivity.
@Override
public void runActivity(@NotNull Project project) {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
if (fileEditorManager instanceof FileEditorManagerImpl) {
final FileEditorManagerImpl manager = (FileEditorManagerImpl) fileEditorManager;
manager.getMainSplitters().openFiles();
manager.initDockableContentFactory();
}
}
use of com.intellij.openapi.fileEditor.FileEditorManager in project intellij-community by JetBrains.
the class SrcFileAnnotator method hideCoverageData.
public void hideCoverageData() {
Editor editor = myEditor;
PsiFile file = myFile;
Document document = myDocument;
if (editor == null || editor.isDisposed() || file == null || document == null)
return;
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
final List<RangeHighlighter> highlighters = editor.getUserData(COVERAGE_HIGHLIGHTERS);
if (highlighters != null) {
for (final RangeHighlighter highlighter : highlighters) {
ApplicationManager.getApplication().invokeLater(() -> highlighter.dispose());
}
editor.putUserData(COVERAGE_HIGHLIGHTERS, null);
}
final Map<FileEditor, EditorNotificationPanel> map = file.getCopyableUserData(NOTIFICATION_PANELS);
if (map != null) {
final VirtualFile vFile = getVirtualFile(file);
boolean freeAll = !fileEditorManager.isFileOpen(vFile);
file.putCopyableUserData(NOTIFICATION_PANELS, null);
for (FileEditor fileEditor : map.keySet()) {
if (!freeAll && !isCurrentEditor(fileEditor)) {
continue;
}
fileEditorManager.removeTopComponent(fileEditor, map.get(fileEditor));
}
}
final DocumentListener documentListener = editor.getUserData(COVERAGE_DOCUMENT_LISTENER);
if (documentListener != null) {
document.removeDocumentListener(documentListener);
editor.putUserData(COVERAGE_DOCUMENT_LISTENER, null);
}
}
use of com.intellij.openapi.fileEditor.FileEditorManager in project intellij-community by JetBrains.
the class CoverageDataManagerImpl method renewInformationInEditors.
private void renewInformationInEditors() {
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
final VirtualFile[] openFiles = fileEditorManager.getOpenFiles();
for (VirtualFile openFile : openFiles) {
final FileEditor[] allEditors = fileEditorManager.getAllEditors(openFile);
applyInformationToEditor(allEditors, openFile);
}
}
Aggregations