Search in sources :

Example 1 with GradleManager

use of org.jetbrains.plugins.gradle.GradleManager in project intellij-community by JetBrains.

the class ConfigurationErrorEvent method process.

@Override
public void process(@NotNull final TestEventXmlView xml) throws TestEventXmlView.XmlParserException {
    final String errorTitle = xml.getEventTitle();
    final String configurationErrorMsg = xml.getEventMessage();
    final boolean openSettings = xml.isEventOpenSettings();
    final Project project = getProject();
    assert project != null;
    final String message = openSettings ? String.format("<br>\n%s<br><br>\n\n<a href=\"Gradle settings\">Open gradle settings</a>", configurationErrorMsg) : String.format("<br>\n%s", configurationErrorMsg);
    GradleNotification.getInstance(project).showBalloon(errorTitle, message, NotificationType.WARNING, new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            notification.expire();
            if ("Gradle settings".equals(event.getDescription())) {
                ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
                assert manager instanceof GradleManager;
                GradleManager gradleManager = (GradleManager) manager;
                Configurable configurable = gradleManager.getConfigurable(project);
                ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
            } else {
                BrowserUtil.browse(event.getDescription());
            }
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ExternalSystemManager(com.intellij.openapi.externalSystem.ExternalSystemManager) GradleManager(org.jetbrains.plugins.gradle.GradleManager) Configurable(com.intellij.openapi.options.Configurable) GradleNotification(org.jetbrains.plugins.gradle.service.project.GradleNotification) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 2 with GradleManager

use of org.jetbrains.plugins.gradle.GradleManager in project android by JetBrains.

the class OpenGradleSettingsHyperlink method execute.

@Override
protected void execute(@NotNull Project project) {
    ExternalSystemManager<?, ?, ?, ?, ?> manager = getManager(GRADLE_SYSTEM_ID);
    assert manager instanceof GradleManager;
    GradleManager gradleManager = (GradleManager) manager;
    Configurable configurable = gradleManager.getConfigurable(project);
    ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
}
Also used : GradleManager(org.jetbrains.plugins.gradle.GradleManager) Configurable(com.intellij.openapi.options.Configurable)

Example 3 with GradleManager

use of org.jetbrains.plugins.gradle.GradleManager in project intellij-community by JetBrains.

the class OpenGradleSettingsCallback method hyperlinkActivated.

@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
    assert manager instanceof GradleManager;
    GradleManager gradleManager = (GradleManager) manager;
    final Configurable configurable = gradleManager.getConfigurable(myProject);
    ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
}
Also used : GradleManager(org.jetbrains.plugins.gradle.GradleManager) Configurable(com.intellij.openapi.options.Configurable)

Example 4 with GradleManager

use of org.jetbrains.plugins.gradle.GradleManager in project azure-tools-for-java by Microsoft.

the class GradleUtils method listGradleProjects.

public static List<ExternalProjectPojo> listGradleProjects(Project project) {
    GradleManager manager = (GradleManager) ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
    Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> projects = manager.getLocalSettingsProvider().fun(project).getAvailableProjects();
    return new ArrayList(projects.keySet());
}
Also used : GradleManager(org.jetbrains.plugins.gradle.GradleManager) ExternalProjectPojo(com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo)

Aggregations

GradleManager (org.jetbrains.plugins.gradle.GradleManager)4 Configurable (com.intellij.openapi.options.Configurable)3 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 ExternalSystemManager (com.intellij.openapi.externalSystem.ExternalSystemManager)1 ExternalProjectPojo (com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo)1 Project (com.intellij.openapi.project.Project)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 GradleNotification (org.jetbrains.plugins.gradle.service.project.GradleNotification)1