Search in sources :

Example 51 with DataNode

use of com.intellij.openapi.externalSystem.model.DataNode in project intellij-community by JetBrains.

the class ExternalSystemApiUtil method findInQueue.

@Nullable
private static DataNode<?> findInQueue(@NotNull Queue<DataNode<?>> queue, @NotNull BooleanFunction<DataNode<?>> predicate) {
    while (!queue.isEmpty()) {
        DataNode node = (DataNode) queue.remove();
        if (predicate.fun(node)) {
            return node;
        }
        //noinspection unchecked
        queue.addAll(node.getChildren());
    }
    return null;
}
Also used : DataNode(com.intellij.openapi.externalSystem.model.DataNode) Nullable(org.jetbrains.annotations.Nullable)

Example 52 with DataNode

use of com.intellij.openapi.externalSystem.model.DataNode in project liferay-ide by liferay.

the class LiferayGradleProjectImportBuilder method createFinalImportCallback.

@Override
protected ExternalProjectRefreshCallback createFinalImportCallback(@NotNull Project project, @NotNull ExternalProjectSettings projectSettings) {
    return new ExternalProjectRefreshCallback() {

        @Override
        public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) {
        }

        @Override
        public void onSuccess(@Nullable DataNode<ProjectData> externalProject) {
            if (externalProject == null) {
                return;
            }
            Runnable selectDataTask = () -> {
                ExternalProjectDataSelectorDialog dialog = new ExternalProjectDataSelectorDialog(project, new InternalExternalProjectInfo(GradleConstants.SYSTEM_ID, projectSettings.getExternalProjectPath(), externalProject));
                if (dialog.hasMultipleDataToSelect()) {
                    dialog.showAndGet();
                } else {
                    Disposer.dispose(dialog.getDisposable());
                }
            };
            ProjectDataManager projectDataManager = ServiceManager.getService(ProjectDataManager.class);
            Runnable importTask = () -> projectDataManager.importData(externalProject, project, false);
            GradleSettings gradleProjectSettings = GradleSettings.getInstance(project);
            boolean showSelectiveImportDialog = gradleProjectSettings.showSelectiveImportDialogOnInitialImport();
            Application application = ApplicationManager.getApplication();
            if (showSelectiveImportDialog && !application.isHeadlessEnvironment()) {
                application.invokeLater(() -> {
                    selectDataTask.run();
                    application.executeOnPooledThread(importTask);
                });
            } else {
                importTask.run();
            }
        }
    };
}
Also used : ProjectDataManager(com.intellij.openapi.externalSystem.service.project.ProjectDataManager) GradleSettings(org.jetbrains.plugins.gradle.settings.GradleSettings) DataNode(com.intellij.openapi.externalSystem.model.DataNode) ExternalProjectDataSelectorDialog(com.intellij.openapi.externalSystem.service.ui.ExternalProjectDataSelectorDialog) ExternalProjectRefreshCallback(com.intellij.openapi.externalSystem.service.project.ExternalProjectRefreshCallback) InternalExternalProjectInfo(com.intellij.openapi.externalSystem.model.internal.InternalExternalProjectInfo) NotNull(org.jetbrains.annotations.NotNull) Application(com.intellij.openapi.application.Application) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DataNode (com.intellij.openapi.externalSystem.model.DataNode)52 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)22 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)14 NotNull (org.jetbrains.annotations.NotNull)13 Module (com.intellij.openapi.module.Module)11 File (java.io.File)9 Project (com.intellij.openapi.project.Project)7 Nullable (org.jetbrains.annotations.Nullable)7 GradleModuleModel (com.android.tools.idea.gradle.project.model.GradleModuleModel)6 GradleSourceSetData (org.jetbrains.plugins.gradle.model.data.GradleSourceSetData)5 ExternalProjectInfo (com.intellij.openapi.externalSystem.model.ExternalProjectInfo)4 IdeModifiableModelsProviderImpl (com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)4 IdeaModule (org.gradle.tooling.model.idea.IdeaModule)4 ExternalProjectRefreshCallback (com.intellij.openapi.externalSystem.service.project.ExternalProjectRefreshCallback)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Task (com.intellij.openapi.progress.Task)3 Pair (com.intellij.openapi.util.Pair)3 MultiMap (com.intellij.util.containers.MultiMap)3 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)2 NdkModuleModel (com.android.tools.idea.gradle.project.model.NdkModuleModel)2