Search in sources :

Example 1 with AndroidPrecompileTask

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

the class AndroidProjectComponent method projectOpened.

@Override
public void projectOpened() {
    final CompilerManager manager = CompilerManager.getInstance(myProject);
    manager.addBeforeTask(new AndroidPrecompileTask());
    myDisposable = Disposer.newDisposable(getClass().getName());
    if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
        if (ProjectFacetManager.getInstance(myProject).hasFacets(AndroidFacet.ID)) {
            createAndroidSpecificComponents();
        } else {
            final MessageBusConnection connection = myProject.getMessageBus().connect(myDisposable);
            connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {

                @Override
                public void facetAdded(@NotNull Facet facet) {
                    if (facet instanceof AndroidFacet) {
                        createAndroidSpecificComponents();
                        connection.disconnect();
                    }
                }
            });
        }
    }
}
Also used : AndroidPrecompileTask(org.jetbrains.android.compiler.AndroidPrecompileTask) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) CompilerManager(com.intellij.openapi.compiler.CompilerManager) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) FacetManagerAdapter(com.intellij.facet.FacetManagerAdapter) Facet(com.intellij.facet.Facet) AndroidFacet(org.jetbrains.android.facet.AndroidFacet)

Aggregations

Facet (com.intellij.facet.Facet)1 FacetManagerAdapter (com.intellij.facet.FacetManagerAdapter)1 CompilerManager (com.intellij.openapi.compiler.CompilerManager)1 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)1 AndroidPrecompileTask (org.jetbrains.android.compiler.AndroidPrecompileTask)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1