Search in sources :

Example 1 with FileStatusListener

use of com.intellij.openapi.vcs.FileStatusListener in project intellij-community by JetBrains.

the class FileStatusManagerImpl method fileStatusChanged.

@Override
public void fileStatusChanged(final VirtualFile file) {
    final Application application = ApplicationManager.getApplication();
    if (!application.isDispatchThread() && !application.isUnitTestMode()) {
        ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {

            @Override
            public void run() {
                fileStatusChanged(file);
            }
        });
        return;
    }
    if (file == null || !file.isValid())
        return;
    FileStatus cachedStatus = getCachedStatus(file);
    if (cachedStatus == FileStatusNull.INSTANCE) {
        return;
    }
    if (cachedStatus == null) {
        cacheChangedFileStatus(file, FileStatusNull.INSTANCE);
        return;
    }
    FileStatus newStatus = calcStatus(file);
    if (cachedStatus == newStatus)
        return;
    cacheChangedFileStatus(file, newStatus);
    for (FileStatusListener listener : myListeners) {
        listener.fileStatusChanged(file);
    }
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) FileStatusListener(com.intellij.openapi.vcs.FileStatusListener) Application(com.intellij.openapi.application.Application) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

Example 2 with FileStatusListener

use of com.intellij.openapi.vcs.FileStatusListener in project intellij-community by JetBrains.

the class FileStatusManagerImpl method fileStatusesChanged.

@Override
public void fileStatusesChanged() {
    if (myProject.isDisposed()) {
        return;
    }
    if (!ApplicationManager.getApplication().isDispatchThread()) {
        ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {

            @Override
            public void run() {
                fileStatusesChanged();
            }
        }, ModalityState.NON_MODAL);
        return;
    }
    myCachedStatuses.clear();
    myWhetherExactlyParentToChanged.clear();
    for (FileStatusListener listener : myListeners) {
        listener.fileStatusesChanged();
    }
}
Also used : FileStatusListener(com.intellij.openapi.vcs.FileStatusListener) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

Aggregations

DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)2 FileStatusListener (com.intellij.openapi.vcs.FileStatusListener)2 Application (com.intellij.openapi.application.Application)1 FileStatus (com.intellij.openapi.vcs.FileStatus)1