Search in sources :

Example 1 with ModuleManagerImpl

use of com.intellij.openapi.module.impl.ModuleManagerImpl in project intellij-community by JetBrains.

the class ProjectImpl method distributeProgress.

private void distributeProgress() {
    ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator == null)
        return;
    ModuleManager moduleManager = ModuleManager.getInstance(this);
    if (!(moduleManager instanceof ModuleManagerImpl)) {
        return;
    }
    double toDistribute = 1 - indicator.getFraction();
    int modulesCount = ((ModuleManagerImpl) moduleManager).getModulePathsCount();
    EditorsSplitters splitters = ((FileEditorManagerImpl) FileEditorManager.getInstance(this)).getMainSplitters();
    int editors = splitters.getEditorsCount();
    double modulesPart = ourClassesAreLoaded || editors == 0 ? toDistribute : toDistribute * 0.5;
    if (modulesCount != 0) {
        double step = modulesPart / modulesCount;
        ((ModuleManagerImpl) moduleManager).setProgressStep(step);
    }
    if (editors != 0) {
        splitters.setProgressStep(toDistribute - modulesPart / editors);
    }
}
Also used : ModuleManagerImpl(com.intellij.openapi.module.impl.ModuleManagerImpl) EditorsSplitters(com.intellij.openapi.fileEditor.impl.EditorsSplitters) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) FileEditorManagerImpl(com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl) ModuleManager(com.intellij.openapi.module.ModuleManager)

Aggregations

EditorsSplitters (com.intellij.openapi.fileEditor.impl.EditorsSplitters)1 FileEditorManagerImpl (com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl)1 ModuleManager (com.intellij.openapi.module.ModuleManager)1 ModuleManagerImpl (com.intellij.openapi.module.impl.ModuleManagerImpl)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1