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;
}
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();
}
}
};
}
Aggregations