com.intellij.openapi.fileEditor.FileDocumentManagerListener Java Examples
The following examples show how to use
com.intellij.openapi.fileEditor.FileDocumentManagerListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlutterSaveActionsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private FlutterSaveActionsManager(@NotNull Project project) { this.myProject = project; final MessageBus bus = project.getMessageBus(); final MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { // Don't try and format read only docs. if (!document.isWritable()) { return; } handleBeforeDocumentSaving(document); } }); }
Example #2
Source File: FlutterSaveActionsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private FlutterSaveActionsManager(@NotNull Project project) { this.myProject = project; final MessageBus bus = project.getMessageBus(); final MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { // Don't try and format read only docs. if (!document.isWritable()) { return; } handleBeforeDocumentSaving(document); } }); }
Example #3
Source File: PsiDocumentManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public PsiDocumentManagerImpl(@Nonnull Project project, @Nonnull DocumentCommitProcessor documentCommitProcessor) { super(project, documentCommitProcessor); EditorFactory.getInstance().getEventMulticaster().addDocumentListener(this, this); ((EditorEventMulticasterImpl)EditorFactory.getInstance().getEventMulticaster()).addPrioritizedDocumentListener(new PriorityEventCollector(), this); MessageBusConnection connection = project.getMessageBus().connect(this); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentLoaded(@Nonnull final VirtualFile virtualFile, @Nonnull Document document) { PsiFile psiFile = ReadAction.compute(() -> myProject.isDisposed() || !virtualFile.isValid() ? null : getCachedPsiFile(virtualFile)); fireDocumentCreated(document, psiFile); } }); Disposer.register(this, () -> ((DocumentCommitThread)myDocumentCommitProcessor).cancelTasksOnProjectDispose(project)); }