Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/io/flutter/actions/FlutterRetargetAppAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.jetbrains.lang.dart.analytics.Analytics;
Expand Down Expand Up @@ -49,7 +50,7 @@ public abstract class FlutterRetargetAppAction extends DumbAwareAction {
public void actionPerformed(@NotNull AnActionEvent e) {
final AnAction action = getAction(e.getProject());
if (action != null) {
action.actionPerformed(e);
ActionUtil.performAction(action, e);
Analytics.report(AnalyticsData.forAction(this, e));
}
}
Expand All @@ -75,7 +76,7 @@ public void update(@NotNull AnActionEvent e) {
if (text != null) {
presentation.setText(text, true);
}
action.update(e);
ActionUtil.updateAction(action, e);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/actions/OpenInAndroidStudioAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditor;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void actionPerformed(@NotNull final AnActionEvent event) {
//noinspection unchecked
final Class<OpenInAndroidStudioAction> opener =
(Class<OpenInAndroidStudioAction>)Class.forName("io.flutter.actions.OpenAndroidModule");
opener.getDeclaredConstructor().newInstance().actionPerformed(event);
ActionUtil.performAction(opener.getDeclaredConstructor().newInstance(), event);
return;
}
catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException |
Expand Down
21 changes: 15 additions & 6 deletions src/io/flutter/editor/NativeEditorNotificationProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
*/
package io.flutter.editor;

import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.ActionUiKind;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
Expand All @@ -22,7 +29,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.JComponent;
import java.util.function.Function;

public class NativeEditorNotificationProvider implements EditorNotificationProvider {
Expand Down Expand Up @@ -117,8 +124,9 @@ class NativeEditorActionsPanel extends EditorNotificationPanel {
text("Flutter commands");

// Ensure this project is a Flutter project by updating the menu action. It will only be visible for Flutter projects.
myAction.update(
AnActionEvent.createEvent(makeContext(), myAction.getTemplatePresentation(), ActionPlaces.EDITOR_TOOLBAR, ActionUiKind.NONE, null));
ActionUtil.updateAction(myAction,
AnActionEvent.createEvent(makeContext(), myAction.getTemplatePresentation(), ActionPlaces.EDITOR_TOOLBAR,
ActionUiKind.NONE, null));

isVisible = myAction.getTemplatePresentation().isVisible();
//noinspection DialogTitleCapitalization
Expand All @@ -140,8 +148,9 @@ private boolean isValidForFile() {

private void performAction() {
// Open Xcode or Android Studio. If already running AS then just open a new window.
myAction.actionPerformed(
AnActionEvent.createEvent(makeContext(), myAction.getTemplatePresentation(), ActionPlaces.EDITOR_TOOLBAR, ActionUiKind.NONE, null));
ActionUtil.performAction(myAction,
AnActionEvent.createEvent(makeContext(), myAction.getTemplatePresentation(), ActionPlaces.EDITOR_TOOLBAR,
ActionUiKind.NONE, null));
}

private DataContext makeContext() {
Expand Down
Loading