Java 类com.intellij.util.DisposeAwareRunnable 实例源码

项目:embeddedlinux-jvmdebugger-intellij    文件:ProjectUtils.java   
/**
 * Runs a thread when initialized
 *
 * @param project
 * @param r
 */
public static void runWhenInitialized(final Project project, final Runnable r) {
    if (project.isDisposed()) return;

    if (isNoBackgroundMode()) {
        r.run();
        return;
    }

    if (!project.isInitialized()) {
        StartupManager.getInstance(project).registerPostStartupActivity(DisposeAwareRunnable.create(r, project));
        return;
    }

    runDumbAware(project, r);
}
项目:spoofax-intellij    文件:MetaborgModuleBuilder.java   
/**
 * Runs a runnable once the specified project has been initialized.
 *
 * @param project
 *            The project.
 * @param runnable
 *            The runnable.
 */
private static void runWhenInitialized(final Project project, final Runnable runnable) {
    if(project.isDisposed())
        // Project is disposed. Nothing to do.
        return;

    final Application application = ApplicationManager.getApplication();
    if(application.isHeadlessEnvironment() || application.isUnitTestMode()) {
        // Runnable cannot be run in background. Just run it.
        runnable.run();
    } else if(!project.isInitialized()) {
        // Run runnable once project has initialized.
        StartupManager.getInstance(project)
            .registerPostStartupActivity(DisposeAwareRunnable.create(runnable, project));
    } else if(DumbService.isDumbAware(runnable)) {
        // The runnable is dumb aware. Just run it.
        runnable.run();
    } else {
        // The runnable is not dumb aware. Run it when applicable.
        DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(runnable, project));
    }
}
项目:intellij-plugin    文件:NavigatorUtil.java   
public static void runWhenInitialized(final Project project, final Runnable r) {
    if (project.isDisposed()) return;

    if (isNoBackgroundMode()) {
        r.run();
        return;
    }

    if (!project.isInitialized()) {
        StartupManager.getInstance(project).registerPostStartupActivity(DisposeAwareRunnable.create(r, project));
        return;
    }

    runDumbAware(project, r);
}
项目:intellij-plugin    文件:NavigatorUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
    }
}
项目:intellij-plugin    文件:NavigatorUtil.java   
public static void invokeAndWait(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeAndWait(DisposeAwareRunnable.create(r, p), state);
    }
}
项目:intellij-plugin    文件:NavigatorUtil.java   
public static void runDumbAware(final Project project, final Runnable r) {
    if (DumbService.isDumbAware(r)) {
        r.run();
    } else {
        DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
    }
}
项目:processing-idea    文件:RunnableActionUtils.java   
public static void runWhenInitialized(final Project project, final Runnable r) {
    if (project.isDisposed()) return;

    if (isNoBackgroundMode()) {
        r.run();
        return;
    }

    if (!project.isInitialized()) {
        StartupManager.getInstance(project).registerPostStartupActivity(DisposeAwareRunnable.create(r, project));
        return;
    }

    runDumbAware(project, r);
}
项目:processing-idea    文件:RunnableActionUtils.java   
public static void runDumbAware(final Project project, final Runnable r) {
    if (DumbService.isDumbAware(r)) {
        r.run();
    }
    else {
        DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
    }
}
项目:intellij-ce-playground    文件:ExternalProjectsViewImpl.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
  }
}
项目:intellij-ce-playground    文件:ExternalSystemUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
  }
}
项目:intellij-ce-playground    文件:MavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
  }
}
项目:intellij-ce-playground    文件:MavenUtil.java   
public static void invokeAndWait(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    if (ApplicationManager.getApplication().isDispatchThread()) {
      r.run();
    }
    else {
      ApplicationManager.getApplication().invokeAndWait(DisposeAwareRunnable.create(r, p), state);
    }
  }
}
项目:intellij-ce-playground    文件:MavenUtil.java   
public static void runDumbAware(final Project project, final Runnable r) {
  if (DumbService.isDumbAware(r)) {
    r.run();
  }
  else {
    DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
  }
}
项目:intellij-ce-playground    文件:MavenUtil.java   
public static void runWhenInitialized(final Project project, final Runnable r) {
  if (project.isDisposed()) return;

  if (isNoBackgroundMode()) {
    r.run();
    return;
  }

  if (!project.isInitialized()) {
    StartupManager.getInstance(project).registerPostStartupActivity(DisposeAwareRunnable.create(r, project));
    return;
  }

  runDumbAware(project, r);
}
项目:intellij-ce-playground    文件:MvcConsole.java   
public void show(@Nullable final Runnable runnable, boolean focus) {
  Runnable r = null;
  if (runnable != null) {
    r = DisposeAwareRunnable.create(runnable, myProject);
  }

  myToolWindow.activate(r, focus);
}
项目:embeddedlinux-jvmdebugger-intellij    文件:ProjectUtils.java   
/**
 * Runs the DumbService
 * @param project
 * @param r
 */
public static void runDumbAware(final Project project, final Runnable r) {
    if (DumbService.isDumbAware(r)) {
        r.run();
    } else {
        DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
    }
}
项目:Aspose.Total-for-Java    文件:AsposeMavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
    }
}
项目:tools-idea    文件:MavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
  }
}
项目:tools-idea    文件:MavenUtil.java   
public static void invokeAndWait(final Project p, final ModalityState state, final Runnable r) {
  if (isNoBackgroundMode()) {
    r.run();
  }
  else {
    if (ApplicationManager.getApplication().isDispatchThread()) {
      r.run();
    }
    else {
      ApplicationManager.getApplication().invokeAndWait(DisposeAwareRunnable.create(r, p), state);
    }
  }
}
项目:tools-idea    文件:MavenUtil.java   
public static void runDumbAware(final Project project, final Runnable r) {
  if (DumbService.isDumbAware(r)) {
    r.run();
  }
  else {
    DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(r, project));
  }
}
项目:tools-idea    文件:MavenUtil.java   
public static void runWhenInitialized(final Project project, final Runnable r) {
  if (project.isDisposed()) return;

  if (isNoBackgroundMode()) {
    r.run();
    return;
  }

  if (!project.isInitialized()) {
    StartupManager.getInstance(project).registerPostStartupActivity(DisposeAwareRunnable.create(r, project));
    return;
  }

  runDumbAware(project, r);
}
项目:tools-idea    文件:MvcConsole.java   
public void show(@Nullable final Runnable runnable, boolean focus) {
  Runnable r = null;
  if (runnable != null) {
    r = DisposeAwareRunnable.create(runnable, myProject);
  }

  myToolWindow.activate(r, focus);
}
项目:Aspose.Diagram-for-Java    文件:AsposeMavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
    }
}
项目:Aspose.OCR-for-Java    文件:AsposeMavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
    }
}
项目:Aspose.Tasks-for-Java    文件:AsposeMavenUtil.java   
public static void invokeLater(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode()) {
        r.run();
    } else {
        ApplicationManager.getApplication().invokeLater(DisposeAwareRunnable.create(r, p), state);
    }
}