Search in sources :

Example 1 with AndroidAutogeneratorMode

use of org.jetbrains.android.compiler.AndroidAutogeneratorMode in project android by JetBrains.

the class AndroidProjectComponent method generate.

private void generate(final Map<AndroidFacet, Collection<AndroidAutogeneratorMode>> facetsToProcess) {
    TransactionGuard.getInstance().submitTransactionAndWait(() -> AndroidCompileUtil.createGenModulesAndSourceRoots(myProject, facetsToProcess.keySet()));
    for (Map.Entry<AndroidFacet, Collection<AndroidAutogeneratorMode>> entry : facetsToProcess.entrySet()) {
        final AndroidFacet facet = entry.getKey();
        final Collection<AndroidAutogeneratorMode> modes = entry.getValue();
        for (AndroidAutogeneratorMode mode : modes) {
            AndroidCompileUtil.doGenerate(facet, mode);
        }
    }
}
Also used : AndroidAutogeneratorMode(org.jetbrains.android.compiler.AndroidAutogeneratorMode) HashMap(com.intellij.util.containers.HashMap) AndroidFacet(org.jetbrains.android.facet.AndroidFacet)

Example 2 with AndroidAutogeneratorMode

use of org.jetbrains.android.compiler.AndroidAutogeneratorMode in project android by JetBrains.

the class AndroidProjectComponent method createAlarmForAutogeneration.

private void createAlarmForAutogeneration() {
    DumbService service = DumbService.getInstance(myProject);
    final Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, myDisposable);
    alarm.addRequest(new Runnable() {

        @Override
        public void run() {
            Map<AndroidFacet, Collection<AndroidAutogeneratorMode>> facetsToProcess = service.runReadActionInSmartMode(() -> checkGenerate());
            if (facetsToProcess.size() > 0) {
                generate(facetsToProcess);
            }
            if (!alarm.isDisposed()) {
                alarm.addRequest(this, 2000);
            }
        }
    }, 2000);
}
Also used : AndroidAutogeneratorMode(org.jetbrains.android.compiler.AndroidAutogeneratorMode) Alarm(com.intellij.util.Alarm) DumbService(com.intellij.openapi.project.DumbService) HashMap(com.intellij.util.containers.HashMap)

Aggregations

HashMap (com.intellij.util.containers.HashMap)2 AndroidAutogeneratorMode (org.jetbrains.android.compiler.AndroidAutogeneratorMode)2 DumbService (com.intellij.openapi.project.DumbService)1 Alarm (com.intellij.util.Alarm)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1