use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class FindUtil method searchAgain.
public static boolean searchAgain(Project project, FileEditor fileEditor, @Nullable DataContext context) {
if (!(fileEditor instanceof TextEditor))
return false;
TextEditor textEditor = (TextEditor) fileEditor;
Editor editor = textEditor.getEditor();
return searchAgain(project, editor, context);
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class SearchAgainAction method actionPerformed.
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
if (editor == null || project == null)
return;
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(project, () -> {
PsiDocumentManager.getInstance(project).commitAllDocuments();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
FindManager findManager = FindManager.getInstance(project);
if (!findManager.selectNextOccurrenceWasPerformed() && findManager.findNextUsageInEditor(editor)) {
return;
}
FindUtil.searchAgain(project, editor, e.getDataContext());
}, IdeBundle.message("command.find.next"), null);
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class SearchAgainAction method update.
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
FileEditor editor = event.getData(PlatformDataKeys.FILE_EDITOR);
presentation.setEnabled(editor instanceof TextEditor);
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class DetectedIndentOptionsNotificationProvider method updateIndentNotification.
public static void updateIndentNotification(@NotNull PsiFile file, boolean enforce) {
VirtualFile vFile = file.getVirtualFile();
if (vFile == null)
return;
if (!ApplicationManager.getApplication().isHeadlessEnvironment() || ApplicationManager.getApplication().isUnitTestMode() && myShowNotificationInTest) {
Project project = file.getProject();
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
if (fileEditorManager == null)
return;
FileEditor fileEditor = fileEditorManager.getSelectedEditor(vFile);
if (fileEditor != null) {
Boolean notifiedFlag = fileEditor.getUserData(NOTIFIED_FLAG);
if (notifiedFlag == null || enforce) {
fileEditor.putUserData(NOTIFIED_FLAG, Boolean.TRUE);
EditorNotifications.getInstance(project).updateNotifications(vFile);
}
}
}
}
use of com.intellij.openapi.fileEditor.FileEditor in project intellij-community by JetBrains.
the class WolfTheProblemSolverImpl method willBeHighlightedAnyway.
private boolean willBeHighlightedAnyway(final VirtualFile file) {
// opened in some editor, and hence will be highlighted automatically sometime later
FileEditor[] selectedEditors = FileEditorManager.getInstance(myProject).getSelectedEditors();
for (FileEditor editor : selectedEditors) {
if (!(editor instanceof TextEditor))
continue;
Document document = ((TextEditor) editor).getEditor().getDocument();
PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getCachedPsiFile(document);
if (psiFile == null)
continue;
if (Comparing.equal(file, psiFile.getVirtualFile()))
return true;
}
return false;
}
Aggregations