com.intellij.openapi.vfs.newvfs.BulkFileListener Java Examples
The following examples show how to use
com.intellij.openapi.vfs.newvfs.BulkFileListener.
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: JarMappings.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
public JarMappings(Project project) { this.project = project; project.getMessageBus().connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { @Override public void after(@NotNull List<? extends VFileEvent> events) { events.forEach(event -> { if (event instanceof VFileContentChangeEvent && event.getFile() != null && event.getFile().equals(librariesFile())) { librariesFileIsUpToDate = false; } }); } }); }
Example #2
Source File: FileContentUtilCore.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess public static void reparseFiles(@Nonnull final Collection<? extends VirtualFile> files) { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { // files must be processed under one write action to prevent firing event for invalid files. final Set<VFilePropertyChangeEvent> events = new THashSet<VFilePropertyChangeEvent>(); for (VirtualFile file : files) { saveOrReload(file, events); } BulkFileListener publisher = ApplicationManager.getApplication().getMessageBus().syncPublisher(VirtualFileManager.VFS_CHANGES); List<VFileEvent> eventList = new ArrayList<VFileEvent>(events); publisher.before(eventList); publisher.after(eventList); } }); }
Example #3
Source File: VirtualFileManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void notifyPropertyChanged(@Nonnull final VirtualFile virtualFile, @Nonnull final String property, final Object oldValue, final Object newValue) { final Application application = ApplicationManager.getApplication(); final Runnable runnable = new Runnable() { @Override public void run() { if (virtualFile.isValid() && !application.isDisposed()) { application.runWriteAction(new Runnable() { @Override public void run() { List<VFilePropertyChangeEvent> events = Collections.singletonList(new VFilePropertyChangeEvent(this, virtualFile, property, oldValue, newValue, false)); BulkFileListener listener = application.getMessageBus().syncPublisher(VirtualFileManager.VFS_CHANGES); listener.before(events); listener.after(events); } }); } } }; application.invokeLater(runnable, ModalityState.NON_MODAL); }
Example #4
Source File: LocalHistoryEventDispatcher.java From consulo with Apache License 2.0 | 5 votes |
@Override public void before(@Nonnull List<? extends VFileEvent> events) { myGateway.runWithVfsEventsDispatchContext(events, true, () -> { for (VFileEvent event : events) { handleBeforeEvent(event); } for (BulkFileListener listener : myVfsEventListeners) { listener.before(events); } }); }
Example #5
Source File: LocalHistoryEventDispatcher.java From consulo with Apache License 2.0 | 5 votes |
@Override public void after(@Nonnull List<? extends VFileEvent> events) { myGateway.runWithVfsEventsDispatchContext(events, false, () -> { for (VFileEvent event : events) { handleAfterEvent(event); } for (BulkFileListener listener : myVfsEventListeners) { listener.after(events); } }); }
Example #6
Source File: FileTreeModel.java From consulo with Apache License 2.0 | 5 votes |
public FileTreeModel(@Nonnull FileChooserDescriptor descriptor, FileRefresher refresher, boolean sortDirectories, boolean sortArchives) { if (refresher != null) register(this, refresher); state = new State(descriptor, refresher, sortDirectories, sortArchives); getApplication().getMessageBus().connect(this).subscribe(VFS_CHANGES, new BulkFileListener() { @Override public void after(@Nonnull List<? extends VFileEvent> events) { invoker.runOrInvokeLater(() -> process(events)); } }); }
Example #7
Source File: LocalHistoryEventDispatcher.java From consulo with Apache License 2.0 | 4 votes |
void addVirtualFileListener(BulkFileListener virtualFileListener, Disposable disposable) { myVfsEventListeners.add(virtualFileListener, disposable); }
Example #8
Source File: LocalHistoryImpl.java From consulo with Apache License 2.0 | 4 votes |
public void addVFSListenerAfterLocalHistoryOne(BulkFileListener virtualFileListener, Disposable disposable) { myEventDispatcher.addVirtualFileListener(virtualFileListener, disposable); }