Search in sources :

Example 1 with AddGradleDslPluginAction

use of org.jetbrains.plugins.gradle.codeInsight.actions.AddGradleDslPluginAction in project android by JetBrains.

the class GradleDslMethodNotFoundErrorHandler method getApplyGradlePluginHyperlink.

@NotNull
private static NotificationHyperlink getApplyGradlePluginHyperlink(@NotNull final VirtualFile virtualFile, @NotNull final NotificationData notification) {
    return new NotificationHyperlink("apply.gradle.plugin", "Apply Gradle plugin") {

        @Override
        protected void execute(@NotNull Project project) {
            openFile(virtualFile, notification, project);
            ActionManager actionManager = ActionManager.getInstance();
            String actionId = AddGradleDslPluginAction.ID;
            AnAction action = actionManager.getAction(actionId);
            assert action instanceof AddGradleDslPluginAction;
            AddGradleDslPluginAction addPluginAction = (AddGradleDslPluginAction) action;
            actionManager.tryToExecute(addPluginAction, ActionCommand.getInputEvent(actionId), null, ActionPlaces.UNKNOWN, true);
        }
    };
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) Project(com.intellij.openapi.project.Project) AddGradleDslPluginAction(org.jetbrains.plugins.gradle.codeInsight.actions.AddGradleDslPluginAction) NotNull(org.jetbrains.annotations.NotNull) AnAction(com.intellij.openapi.actionSystem.AnAction) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with AddGradleDslPluginAction

use of org.jetbrains.plugins.gradle.codeInsight.actions.AddGradleDslPluginAction in project intellij-community by JetBrains.

the class ApplyGradlePluginCallback method hyperlinkActivated.

@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
    new GotoSourceNotificationCallback(myNotificationData, myProject).hyperlinkActivated(notification, event);
    final AnAction action = ActionManager.getInstance().getAction(AddGradleDslPluginAction.ID);
    assert action instanceof AddGradleDslPluginAction;
    final AddGradleDslPluginAction addGradleDslPluginAction = (AddGradleDslPluginAction) action;
    ActionManager.getInstance().tryToExecute(addGradleDslPluginAction, ActionCommand.getInputEvent(AddGradleDslPluginAction.ID), null, ActionPlaces.UNKNOWN, true);
}
Also used : AddGradleDslPluginAction(org.jetbrains.plugins.gradle.codeInsight.actions.AddGradleDslPluginAction) AnAction(com.intellij.openapi.actionSystem.AnAction)

Aggregations

AnAction (com.intellij.openapi.actionSystem.AnAction)2 AddGradleDslPluginAction (org.jetbrains.plugins.gradle.codeInsight.actions.AddGradleDslPluginAction)2 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 Project (com.intellij.openapi.project.Project)1 NotNull (org.jetbrains.annotations.NotNull)1