use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.
the class GradleSyncIntegrationTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
Project project = getProject();
GradleProjectSettings projectSettings = new GradleProjectSettings();
projectSettings.setDistributionType(DEFAULT_WRAPPED);
GradleSettings.getInstance(project).setLinkedProjectsSettings(Collections.singletonList(projectSettings));
}
use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project android by JetBrains.
the class IdeFrameFixture method useLocalGradleDistribution.
@NotNull
public IdeFrameFixture useLocalGradleDistribution(@NotNull String gradleHome) {
GradleProjectSettings settings = getGradleSettings();
settings.setDistributionType(LOCAL);
settings.setGradleHome(gradleHome);
return this;
}
use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project intellij-community by JetBrains.
the class UseDistributionWithSourcesNotificationProvider method createNotificationPanel.
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
try {
if (GradleConstants.DEFAULT_SCRIPT_NAME.equals(file.getName()) || GradleConstants.SETTINGS_FILE_NAME.equals(file.getName())) {
final Module module = ModuleUtilCore.findModuleForFile(file, myProject);
if (module == null)
return null;
final String rootProjectPath = getRootProjectPath(module);
if (rootProjectPath == null)
return null;
final GradleProjectSettings settings = GradleSettings.getInstance(module.getProject()).getLinkedProjectSettings(rootProjectPath);
if (settings == null || settings.getDistributionType() != DistributionType.DEFAULT_WRAPPED)
return null;
if (settings.isDisableWrapperSourceDistributionNotification())
return null;
if (!showUseDistributionWithSourcesTip(rootProjectPath))
return null;
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(GradleBundle.message("gradle.notifications.use.distribution.with.sources"));
panel.createActionLabel(GradleBundle.message("gradle.notifications.hide.tip"), () -> {
settings.setDisableWrapperSourceDistributionNotification(true);
EditorNotifications.getInstance(module.getProject()).updateAllNotifications();
});
panel.createActionLabel(GradleBundle.message("gradle.notifications.apply.suggestion"), () -> {
updateDefaultWrapperConfiguration(rootProjectPath);
EditorNotifications.getInstance(module.getProject()).updateAllNotifications();
ExternalSystemUtil.refreshProject(module.getProject(), GradleConstants.SYSTEM_ID, settings.getExternalProjectPath(), false, ProgressExecutionMode.START_IN_FOREGROUND_ASYNC);
});
return panel;
}
} catch (ProcessCanceledException | IndexNotReadyException ignored) {
}
return null;
}
use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project intellij-community by JetBrains.
the class GradleInstallationManager method doGetGradleHome.
/**
* Tries to return file handle that points to the gradle installation home.
*
* @param project target project (if any)
* @param linkedProjectPath path to the target linked project config
* @return file handle that points to the gradle installation home (if any)
*/
@Nullable
private File doGetGradleHome(@Nullable Project project, @NotNull String linkedProjectPath) {
if (project == null) {
return null;
}
GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedProjectPath);
if (settings == null || settings.getDistributionType() == null) {
return null;
}
String gradleHome = settings.getDistributionType() == DistributionType.WRAPPED ? GradleLocalSettings.getInstance(project).getGradleHome(linkedProjectPath) : settings.getGradleHome();
return getGradleHome(settings.getDistributionType(), linkedProjectPath, gradleHome);
}
use of org.jetbrains.plugins.gradle.settings.GradleProjectSettings in project intellij-community by JetBrains.
the class GradleOpenProjectCompositeConfigurationAction method isVisible.
@Override
protected boolean isVisible(AnActionEvent e) {
final Project project = getProject(e);
if (project == null)
return false;
ProjectSystemId systemId = getSystemId(e);
if (!GradleConstants.SYSTEM_ID.equals(systemId))
return false;
if (GradleSettings.getInstance(project).getLinkedProjectsSettings().size() > 1) {
final ProjectNode projectNode = ExternalSystemDataKeys.SELECTED_PROJECT_NODE.getData(e.getDataContext());
if (projectNode == null || projectNode.getData() == null)
return false;
GradleProjectSettings projectSettings = GradleSettings.getInstance(project).getLinkedProjectSettings(projectNode.getData().getLinkedExternalProjectPath());
GradleProjectSettings.CompositeBuild compositeBuild = null;
if (projectSettings != null) {
compositeBuild = projectSettings.getCompositeBuild();
}
if (compositeBuild == null || compositeBuild.getCompositeDefinitionSource() == CompositeDefinitionSource.IDE)
return true;
}
return false;
}
Aggregations