use of com.intellij.openapi.externalSystem.model.internal.InternalExternalProjectInfo in project intellij-community by JetBrains.
the class ExternalProjectsDataStorage method load.
public synchronized void load() {
myExternalRootProjects.clear();
try {
final Collection<InternalExternalProjectInfo> projectInfos = load(myProject);
for (InternalExternalProjectInfo projectInfo : projectInfos) {
if (validate(projectInfo)) {
myExternalRootProjects.put(Pair.create(projectInfo.getProjectSystemId(), new File(projectInfo.getExternalProjectPath())), projectInfo);
}
}
} catch (IOException e) {
LOG.debug(e);
}
mergeLocalSettings();
}
use of com.intellij.openapi.externalSystem.model.internal.InternalExternalProjectInfo in project intellij-community by JetBrains.
the class ExternalProjectsDataStorage method load.
@NotNull
private static Collection<InternalExternalProjectInfo> load(@NotNull Project project) throws IOException {
SmartList<InternalExternalProjectInfo> projects = new SmartList<>();
@SuppressWarnings("unchecked") final File configurationFile = getProjectConfigurationFile(project);
if (!configurationFile.isFile())
return projects;
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(configurationFile)));
try {
final String storage_version = in.readUTF();
if (!STORAGE_VERSION.equals(storage_version))
return projects;
final int size = in.readInt();
ObjectInputStream os = new ObjectInputStream(in);
try {
for (int i = 0; i < size; i++) {
//noinspection unchecked
InternalExternalProjectInfo projectDataDataNode = (InternalExternalProjectInfo) os.readObject();
projects.add(projectDataDataNode);
}
} catch (Exception e) {
throw new IOException(e);
} finally {
os.close();
}
} finally {
in.close();
}
return projects;
}
use of com.intellij.openapi.externalSystem.model.internal.InternalExternalProjectInfo in project intellij-community by JetBrains.
the class GradleProjectImportBuilder method createFinalImportCallback.
@Override
protected ExternalProjectRefreshCallback createFinalImportCallback(@NotNull final Project project, @NotNull ExternalProjectSettings projectSettings) {
return new ExternalProjectRefreshCallback() {
@Override
public void onSuccess(@Nullable final 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());
}
};
Runnable importTask = () -> ServiceManager.getService(ProjectDataManager.class).importData(externalProject, project, false);
if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
ApplicationManager.getApplication().invokeLater(() -> {
selectDataTask.run();
ApplicationManager.getApplication().executeOnPooledThread(importTask);
});
} else {
importTask.run();
}
}
@Override
public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) {
}
};
}
Aggregations