Search in sources :

Example 1 with RefreshSession

use of com.intellij.openapi.vfs.newvfs.RefreshSession in project intellij-community by JetBrains.

the class FileRefresher method dispose.

@Override
public void dispose() {
    disposed = true;
    unwatch();
    RefreshSession session = this.session.getAndSet(null);
    if (session != null)
        RefreshQueue.getInstance().cancelSession(session.getId());
}
Also used : RefreshSession(com.intellij.openapi.vfs.newvfs.RefreshSession)

Example 2 with RefreshSession

use of com.intellij.openapi.vfs.newvfs.RefreshSession in project intellij-community by JetBrains.

the class PlatformVirtualFileManager method doRefresh.

@Override
protected long doRefresh(boolean asynchronous, @Nullable Runnable postAction) {
    if (!asynchronous) {
        ApplicationManager.getApplication().assertIsDispatchThread();
    }
    // todo: get an idea how to deliver changes from local FS to jar fs before they go refresh
    RefreshSession session = RefreshQueue.getInstance().createSession(asynchronous, true, postAction);
    session.addAllFiles(myManagingFS.getRoots());
    session.launch();
    super.doRefresh(asynchronous, postAction);
    return session.getId();
}
Also used : RefreshSession(com.intellij.openapi.vfs.newvfs.RefreshSession)

Example 3 with RefreshSession

use of com.intellij.openapi.vfs.newvfs.RefreshSession in project intellij-community by JetBrains.

the class SaveAndSyncHandlerImpl method maybeRefresh.

public void maybeRefresh(@NotNull ModalityState modalityState) {
    if (myBlockSyncOnFrameActivationCount.get() == 0 && mySettings.isSyncOnFrameActivation()) {
        RefreshQueue queue = RefreshQueue.getInstance();
        queue.cancelSession(myRefreshSessionId);
        RefreshSession session = queue.createSession(true, true, null, modalityState);
        session.addAllFiles(ManagingFS.getInstance().getLocalRoots());
        myRefreshSessionId = session.getId();
        session.launch();
        LOG.debug("vfs refreshed");
    } else if (LOG.isDebugEnabled()) {
        LOG.debug("vfs refresh rejected, blocked: " + (myBlockSyncOnFrameActivationCount.get() != 0) + ", isSyncOnFrameActivation: " + mySettings.isSyncOnFrameActivation());
    }
}
Also used : RefreshQueue(com.intellij.openapi.vfs.newvfs.RefreshQueue) RefreshSession(com.intellij.openapi.vfs.newvfs.RefreshSession)

Example 4 with RefreshSession

use of com.intellij.openapi.vfs.newvfs.RefreshSession in project intellij-community by JetBrains.

the class FileRefresher method launch.

private void launch() {
    List<VirtualFile> files = this.files;
    if (!disposed && !paused && files != null) {
        RefreshSession session = RefreshQueue.getInstance().createSession(true, recursive, this::finish);
        if (this.session.compareAndSet(null, session)) {
            session.addAllFiles(files);
            session.launch();
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RefreshSession(com.intellij.openapi.vfs.newvfs.RefreshSession)

Aggregations

RefreshSession (com.intellij.openapi.vfs.newvfs.RefreshSession)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 RefreshQueue (com.intellij.openapi.vfs.newvfs.RefreshQueue)1