diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointIntentionAction.kt b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointIntentionAction.kt index 4272d5a47e0e..9288ec2facf7 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointIntentionAction.kt +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointIntentionAction.kt @@ -27,9 +27,9 @@ internal abstract class BreakpointIntentionAction(protected val myBreakpoint: XB "Do not stop if called from: " + StringUtil.getShortName(StringUtil.substringBefore(myCaller, "(") ?: myCaller)) { - override fun update(e: AnActionEvent?) { + override fun update(e: AnActionEvent) { with(myBreakpoint.properties as JavaBreakpointProperties<*>) { - e?.presentation?.setEnabled(!isCALLER_FILTERS_ENABLED || !callerExclusionFilters.contains(ClassFilter(myCaller))) + e.presentation.setEnabled(!isCALLER_FILTERS_ENABLED || !callerExclusionFilters.contains(ClassFilter(myCaller))) } } @@ -49,9 +49,9 @@ internal abstract class BreakpointIntentionAction(protected val myBreakpoint: XB "Stop only if called from: " + StringUtil.getShortName(StringUtil.substringBefore(myCaller, "(") ?: myCaller)) { - override fun update(e: AnActionEvent?) { + override fun update(e: AnActionEvent) { with(myBreakpoint.properties as JavaBreakpointProperties<*>) { - e?.presentation?.setEnabled(!isCALLER_FILTERS_ENABLED || !callerFilters.contains(ClassFilter(myCaller))) + e.presentation.setEnabled(!isCALLER_FILTERS_ENABLED || !callerFilters.contains(ClassFilter(myCaller))) } } @@ -69,9 +69,9 @@ internal abstract class BreakpointIntentionAction(protected val myBreakpoint: XB internal class AddInstanceFilter(breakpoint: XBreakpoint<*>, private val myInstance: Long) : BreakpointIntentionAction(breakpoint, "Stop only in the current object") { - override fun update(e: AnActionEvent?) { + override fun update(e: AnActionEvent) { with(myBreakpoint.properties as JavaBreakpointProperties<*>) { - e?.presentation?.setEnabled(!isINSTANCE_FILTERS_ENABLED || !instanceFilters.contains(InstanceFilter.create(myInstance))) + e.presentation.setEnabled(!isINSTANCE_FILTERS_ENABLED || !instanceFilters.contains(InstanceFilter.create(myInstance))) } } @@ -87,9 +87,9 @@ internal abstract class BreakpointIntentionAction(protected val myBreakpoint: XB internal class AddClassFilter(breakpoint: XBreakpoint<*>, private val myClass: String) : BreakpointIntentionAction(breakpoint, "Stop only in the class: ${StringUtil.getShortName(myClass)}") { - override fun update(e: AnActionEvent?) { + override fun update(e: AnActionEvent) { with(myBreakpoint.properties as JavaBreakpointProperties<*>) { - e?.presentation?.setEnabled(!isCLASS_FILTERS_ENABLED || !classFilters.contains(ClassFilter(myClass))) + e.presentation.setEnabled(!isCLASS_FILTERS_ENABLED || !classFilters.contains(ClassFilter(myClass))) } } @@ -107,9 +107,9 @@ internal abstract class BreakpointIntentionAction(protected val myBreakpoint: XB internal class AddClassNotFilter(breakpoint: XBreakpoint<*>, private val myClass: String) : BreakpointIntentionAction(breakpoint, "Do not stop in the class: ${StringUtil.getShortName(myClass)}") { - override fun update(e: AnActionEvent?) { + override fun update(e: AnActionEvent) { with(myBreakpoint.properties as JavaBreakpointProperties<*>) { - e?.presentation?.setEnabled(!isCLASS_FILTERS_ENABLED || !classExclusionFilters.contains(ClassFilter(myClass))) + e.presentation.setEnabled(!isCLASS_FILTERS_ENABLED || !classExclusionFilters.contains(ClassFilter(myClass))) } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java index 407dfe984bce..b47a26edfedd 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java @@ -54,7 +54,6 @@ import com.intellij.util.ArrayUtil; import com.intellij.util.IconUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FilteringIterator; -import java.util.HashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -224,7 +223,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent @Override public void run(AnActionButton button) { if (popupItems.isEmpty()) { - new AttachFilesAction(myDescriptor.getAttachFilesActionName()).actionPerformed(null); + new AttachFilesAction(myDescriptor.getAttachFilesActionName()).perform(); return; } @@ -417,6 +416,10 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent @Override public void actionPerformed(@Nullable AnActionEvent e) { + perform(); + } + + void perform() { VirtualFile toSelect = getFileToSelect(); List roots = selectRoots(toSelect); if (roots.isEmpty()) return; diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java index 5a59d91cef4a..3d0e344f9bad 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java @@ -217,7 +217,7 @@ public abstract class AnAction implements PossiblyDumbAware { * * @param e Carries information on the invocation place and data available */ - public void update(AnActionEvent e) { + public void update(@NotNull AnActionEvent e) { } /** @@ -256,7 +256,7 @@ public abstract class AnAction implements PossiblyDumbAware { * * @param e Carries information on the invocation place */ - public abstract void actionPerformed(AnActionEvent e); + public abstract void actionPerformed(@NotNull AnActionEvent e); protected void setShortcutSet(@NotNull ShortcutSet shortcutSet) { if (myIsGlobal && myShortcutSet != shortcutSet) { diff --git a/platform/lang-api/src/com/intellij/execution/ui/actions/CloseAction.java b/platform/lang-api/src/com/intellij/execution/ui/actions/CloseAction.java index 888647851475..7f5e8e57cbc5 100644 --- a/platform/lang-api/src/com/intellij/execution/ui/actions/CloseAction.java +++ b/platform/lang-api/src/com/intellij/execution/ui/actions/CloseAction.java @@ -42,6 +42,10 @@ public class CloseAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { + perform(); + } + + public void perform() { final RunContentDescriptor contentDescriptor = getContentDescriptor(); if (contentDescriptor == null) { return; diff --git a/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java b/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java index 89813163cbf6..08a0729b6286 100644 --- a/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java +++ b/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java @@ -15,8 +15,8 @@ */ package com.intellij.execution.util; +import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.util.Condition; import com.intellij.ui.*; import com.intellij.ui.table.TableView; import com.intellij.util.containers.ContainerUtil; @@ -66,7 +66,7 @@ public abstract class ListTableWithButtons extends Observable { int nextRow = nextColumn == 0 ? row + 1 : row; if (nextRow > myTableView.getRowCount() - 1) { if (myElements.isEmpty() || !ListTableWithButtons.this.isEmpty(myElements.get(myElements.size() - 1))) { - ToolbarDecorator.findAddButton(myPanel).actionPerformed(null); + ToolbarDecorator.findAddButton(myPanel).actionPerformed(AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataId -> null)); return; } else { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipWithActionRenderer.kt b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipWithActionRenderer.kt index 2ac32fc28880..a27b0df846ef 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipWithActionRenderer.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipWithActionRenderer.kt @@ -150,7 +150,7 @@ internal class DaemonTooltipWithActionRenderer(text: String?, buttons.add(createKeymapHint(shortcutShowAllActionsText), gridBag.next().fillCellHorizontally().insets(0, 4, 0, 20)) actions.add(object : AnAction() { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { runFixAction.run() } @@ -160,7 +160,7 @@ internal class DaemonTooltipWithActionRenderer(text: String?, }) actions.add(object : AnAction() { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { showAllFixes.run() } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java index fe7e6c1ec4a1..0d49a04fe4fb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java @@ -47,6 +47,10 @@ public class WrapWithCustomTemplateAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { + perform(); + } + + public void perform() { final Document document = myEditor.getDocument(); final VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file != null) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/unwrap/UnwrapHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/unwrap/UnwrapHandler.java index 7edd9fc249b8..b9ffba308f47 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/unwrap/UnwrapHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/unwrap/UnwrapHandler.java @@ -62,13 +62,13 @@ public class UnwrapHandler implements CodeInsightActionHandler { @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (!EditorModificationUtil.checkModificationAllowed(editor)) return; - List options = collectOptions(project, editor, file); + List options = collectOptions(project, editor, file); selectOption(options, editor, file); } @NotNull - private static List collectOptions(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { - List result = new ArrayList<>(); + private static List collectOptions(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { + List result = new ArrayList<>(); UnwrapDescriptor descriptor = getUnwrapDescription(file); @@ -88,24 +88,24 @@ public class UnwrapHandler implements CodeInsightActionHandler { return LanguageUnwrappers.INSTANCE.forLanguage(file.getLanguage()); } - private static AnAction createUnwrapAction(@NotNull Unwrapper u, @NotNull PsiElement el, @NotNull Editor ed, @NotNull Project p) { + private static MyUnwrapAction createUnwrapAction(@NotNull Unwrapper u, @NotNull PsiElement el, @NotNull Editor ed, @NotNull Project p) { return new MyUnwrapAction(p, ed, u, el); } - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { if (options.isEmpty()) return; if (!getUnwrapDescription(file).showOptionsDialog() || ApplicationManager.getApplication().isUnitTestMode() ) { - options.get(0).actionPerformed(null); + options.get(0).perform(); return; } showPopup(options, editor); } - private static void showPopup(final List options, Editor editor) { + private static void showPopup(final List options, Editor editor) { final ScopeHighlighter highlighter = new ScopeHighlighter(editor); List model = options.stream().map(a -> ((MyUnwrapAction)a).getName()).collect(Collectors.toList()); @@ -122,7 +122,7 @@ public class UnwrapHandler implements CodeInsightActionHandler { .setSelectionMode(ListSelectionModel.SINGLE_SELECTION) .setResizable(false) .setRequestFocus(true) - .setItemChosenCallback((selectedValue) -> optionByName.apply(selectedValue).actionPerformed(null)) + .setItemChosenCallback((selectedValue) -> optionByName.apply(selectedValue).perform()) .setItemSelectedCallback(s -> { if (s != null) { MyUnwrapAction a = optionByName.apply(s); @@ -145,7 +145,7 @@ public class UnwrapHandler implements CodeInsightActionHandler { return manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); } - private static class MyUnwrapAction extends AnAction { + protected static class MyUnwrapAction extends AnAction { private static final Key CARET_POS_KEY = new Key<>("UNWRAP_HANDLER_CARET_POSITION"); private final Project myProject; @@ -164,6 +164,10 @@ public class UnwrapHandler implements CodeInsightActionHandler { @Override public void actionPerformed(AnActionEvent e) { + perform(); + } + + void perform() { final PsiFile file = myElement.getContainingFile(); if (!FileModificationService.getInstance().prepareFileForWrite(file)) return; diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunDashboardTypesPanel.kt b/platform/lang-impl/src/com/intellij/execution/impl/RunDashboardTypesPanel.kt index f6d833471895..574d995d885f 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunDashboardTypesPanel.kt +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunDashboardTypesPanel.kt @@ -100,7 +100,7 @@ internal class RunDashboardTypesPanel(private val myProject: Project) : JPanel(B val actionGroup = DefaultActionGroup(null, false) configurationTypes.forEach { actionGroup.add(object : AnAction(it.displayName, null, it.icon) { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { listModel.add(it) listModel.sort(IGNORE_CASE_DISPLAY_NAME_COMPARATOR) list.selectedIndex = listModel.getElementIndex(it) @@ -109,7 +109,7 @@ internal class RunDashboardTypesPanel(private val myProject: Project) : JPanel(B } if (hiddenCount > 0) { actionGroup.add(object : AnAction(ExecutionBundle.message("show.irrelevant.configurations.action.name", hiddenCount)) { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { showAddPopup(button, false) } }) diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java index 70a1169eb4bb..97bf7cf08000 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java @@ -1266,7 +1266,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac for (AnAction action : myMinimizedViewActions.getChildren(null)) { Content content = ((RestoreViewAction)action).getContent(); if (key.equals(content.getUserData(ViewImpl.ID))) { - action.actionPerformed(null); + action.actionPerformed(AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataId -> null)); return; } } diff --git a/platform/lang-impl/src/com/intellij/internal/ComputeVirtualFileNameStatAction.java b/platform/lang-impl/src/com/intellij/internal/ComputeVirtualFileNameStatAction.java index 4c5429435e79..9ce59eca54f0 100644 --- a/platform/lang-impl/src/com/intellij/internal/ComputeVirtualFileNameStatAction.java +++ b/platform/lang-impl/src/com/intellij/internal/ComputeVirtualFileNameStatAction.java @@ -25,20 +25,19 @@ import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.ManagingFS; import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry; -import com.intellij.util.Function; import gnu.trove.TObjectIntHashMap; import gnu.trove.TObjectIntProcedure; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; public class ComputeVirtualFileNameStatAction extends AnAction implements DumbAware { public ComputeVirtualFileNameStatAction() { super("Compute VF Name Statistics"); } - public static void main(String[] args) { - new ComputeVirtualFileNameStatAction().actionPerformed(null); - } @Override public void actionPerformed(AnActionEvent e) { long start = System.currentTimeMillis(); diff --git a/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java b/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java index 9ebdca7308f5..6ece245f1f48 100644 --- a/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java +++ b/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java @@ -569,7 +569,7 @@ public abstract class PerFileConfigurableBase implements SearchableConfigurab AnActionEvent event = AnActionEvent.createFromAnAction(changeAction, null, ActionPlaces.UNKNOWN, dataContext); changeAction.update(event); panel.revalidate(); - if (!editor) myResetRunnables.add(() -> changeAction.update(null)); + if (!editor) myResetRunnables.add(() -> changeAction.update(event)); return panel; } diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java index c25ebad2cc9f..48abe278f60c 100644 --- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java +++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java @@ -85,7 +85,7 @@ public class SystemHealthMonitor implements ApplicationComponent { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { notification.expire(); - ActionManager.getInstance().getAction(SWITCH_JDK_ACTION).actionPerformed(null); + ActionManager.getInstance().getAction(SWITCH_JDK_ACTION).actionPerformed(e); } }; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SwitchBootJdkAction.java b/platform/platform-impl/src/com/intellij/ide/actions/SwitchBootJdkAction.java index 6f278e1953dc..7caa968585d7 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/SwitchBootJdkAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/SwitchBootJdkAction.java @@ -62,6 +62,10 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { @Override public void actionPerformed(@Nullable AnActionEvent e) { Project project = e != null ? e.getProject() : null; + perform(project); + } + + public void perform(Project project) { new Task.Modal(project, "Looking for Available JDKs", true) { private JdkBundleList myBundleList; private File myConfigFile; diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java index b986f411ba63..e1bf133901b9 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java @@ -114,7 +114,7 @@ public class DarculaTest { @Override public void eventDispatched(AWTEvent event) { if (event instanceof KeyEvent && event.getID() == KeyEvent.KEY_PRESSED && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_F1) { - new ShowUIDefaultsAction().actionPerformed(null); + new ShowUIDefaultsAction().perform(null); } } }, AWTEvent.KEY_EVENT_MASK); diff --git a/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java b/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java index 9bccba2ee54c..895998c14c5e 100644 --- a/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java +++ b/platform/platform-impl/src/com/intellij/internal/focus/FocusDebuggerAction.java @@ -33,7 +33,6 @@ import java.awt.*; import java.awt.event.AWTEventListener; import java.awt.event.FocusEvent; import java.util.Arrays; -import java.util.function.Consumer; /** * @author spleaner @@ -44,11 +43,15 @@ public class FocusDebuggerAction extends AnAction implements DumbAware { public FocusDebuggerAction() { if (Boolean.getBoolean("idea.ui.debug.mode")) { - ApplicationManager.getApplication().invokeLater(() -> actionPerformed(null)); + ApplicationManager.getApplication().invokeLater(() -> perform()); } } public void actionPerformed(final AnActionEvent e) { + perform(); + } + + private void perform() { if (myFocusDrawer == null) { myFocusDrawer = new FocusDrawer(); myFocusDrawer.start(); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java index 85fdba75b986..48c0e1b1e632 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java @@ -149,7 +149,7 @@ public class RecentProjectPanel extends JPanel { if (cellBounds.contains(event.getPoint())) { Object selection = myList.getSelectedValue(); if (Registry.is("removable.welcome.screen.projects") && rectInListCoordinatesContains(cellBounds, event.getPoint())) { - removeRecentProjectAction.actionPerformed(null); + removeRecentProject(); } else if (selection != null) { AnAction selectedAction = (AnAction) selection; AnActionEvent actionEvent = AnActionEvent.createFromInputEvent(selectedAction, event, ActionPlaces.WELCOME_SCREEN); @@ -186,21 +186,7 @@ public class RecentProjectPanel extends JPanel { removeRecentProjectAction = new AnAction() { @Override public void actionPerformed(AnActionEvent e) { - Object[] selection = myList.getSelectedValues(); - - if (selection != null && selection.length > 0) { - final int rc = Messages.showOkCancelDialog(RecentProjectPanel.this, - "Remove '" + StringUtil.join(selection, action -> ((AnAction)action).getTemplatePresentation().getText(), "'\n'") + - "' from recent projects list?", - "Remove Recent Project", - Messages.getQuestionIcon()); - if (rc == Messages.OK) { - for (Object projectAction : selection) { - removeRecentProjectElement(projectAction); - } - ListUtil.removeSelectedItems(myList); - } - } + removeRecentProject(); } @Override @@ -244,6 +230,25 @@ public class RecentProjectPanel extends JPanel { setBorder(new LineBorder(WelcomeScreenColors.BORDER_COLOR)); } + private void removeRecentProject() { + Object[] selection = myList.getSelectedValues(); + + if (selection != null && selection.length > 0) { + final int rc = Messages.showOkCancelDialog(RecentProjectPanel.this, + "Remove '" + StringUtil + .join(selection, action -> ((AnAction)action).getTemplatePresentation().getText(), "'\n'") + + "' from recent projects list?", + "Remove Recent Project", + Messages.getQuestionIcon()); + if (rc == Messages.OK) { + for (Object projectAction : selection) { + removeRecentProjectElement(projectAction); + } + ListUtil.removeSelectedItems(myList); + } + } + } + protected boolean isPathValid(String path) { return myChecker == null || myChecker.isValid(path); } diff --git a/platform/platform-impl/src/com/intellij/platform/AttachProjectAction.kt b/platform/platform-impl/src/com/intellij/platform/AttachProjectAction.kt index a22707c670d2..03227f7c4dc9 100644 --- a/platform/platform-impl/src/com/intellij/platform/AttachProjectAction.kt +++ b/platform/platform-impl/src/com/intellij/platform/AttachProjectAction.kt @@ -38,14 +38,14 @@ import java.nio.file.Paths * @author traff */ class AttachProjectAction : AnAction("Attach project..."), DumbAware { - override fun update(e: AnActionEvent?) { - e?.presentation?.isEnabledAndVisible = ProjectAttachProcessor.canAttachToProject() && + override fun update(e: AnActionEvent) { + e.presentation.isEnabledAndVisible = ProjectAttachProcessor.canAttachToProject() && GeneralSettings.getInstance().confirmOpenNewProject != GeneralSettings.OPEN_PROJECT_ASK } - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { val descriptor = OpenProjectFileChooserDescriptor(true) - val project = e?.getData(CommonDataKeys.PROJECT) + val project = e.getData(CommonDataKeys.PROJECT) FileChooser.chooseFiles(descriptor, project, null) { files -> diff --git a/platform/platform-impl/src/com/intellij/ui/ShowUIDefaultsAction.java b/platform/platform-impl/src/com/intellij/ui/ShowUIDefaultsAction.java index cfa283eb10f3..c3a9efba169b 100644 --- a/platform/platform-impl/src/com/intellij/ui/ShowUIDefaultsAction.java +++ b/platform/platform-impl/src/com/intellij/ui/ShowUIDefaultsAction.java @@ -48,6 +48,11 @@ import java.util.stream.Collectors; public class ShowUIDefaultsAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { + final Project project = getEventProject(e); + perform(project); + } + + public void perform(Project project) { final UIDefaults defaults = UIManager.getDefaults(); Enumeration keys = defaults.keys(); final Object[][] data = new Object[defaults.size()][2]; @@ -61,7 +66,6 @@ public class ShowUIDefaultsAction extends AnAction implements DumbAware { Arrays.sort(data, (o1, o2) -> StringUtil.naturalCompare(o1[0 ].toString(), o2[0].toString())); - final Project project = getEventProject(e); new DialogWrapper(project) { { setTitle("Edit LaF Defaults"); @@ -200,7 +204,7 @@ public class ShowUIDefaultsAction extends AnAction implements DumbAware { private @Nullable Integer editNumber(String key, String value) { String newValue = Messages.showInputDialog(getRootPane(), "Enter new value for " + key, "Number Editor", null, value, - new InputValidator() { + new InputValidator() { @Override public boolean checkInput(String inputString) { try { diff --git a/platform/testFramework/src/com/intellij/codeInsight/unwrap/UnwrapTestCase.java b/platform/testFramework/src/com/intellij/codeInsight/unwrap/UnwrapTestCase.java index 69cab7005f89..4b4afd65d7cb 100644 --- a/platform/testFramework/src/com/intellij/codeInsight/unwrap/UnwrapTestCase.java +++ b/platform/testFramework/src/com/intellij/codeInsight/unwrap/UnwrapTestCase.java @@ -36,9 +36,9 @@ public abstract class UnwrapTestCase extends LightPlatformCodeInsightTestCase { UnwrapHandler h = new UnwrapHandler() { @Override - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { if (options.isEmpty()) return; - options.get(option).actionPerformed(null); + options.get(option).perform(); } }; @@ -54,7 +54,7 @@ public abstract class UnwrapTestCase extends LightPlatformCodeInsightTestCase { UnwrapHandler h = new UnwrapHandler() { @Override - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { for (AnAction each : options) { actualOptions.add(each.getTemplatePresentation().getText()); } diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/PerformScriptAction.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/PerformScriptAction.kt index a4396b69bdbc..93886e3bd934 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/PerformScriptAction.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/PerformScriptAction.kt @@ -33,7 +33,7 @@ class PerformScriptAction : AnAction(null, "Run GUI Script", AllIcons.Actions.Ex val LOG: Logger = Logger.getInstance(PerformScriptAction::class.java) } - override fun actionPerformed(p0: AnActionEvent?) { + override fun actionPerformed(p0: AnActionEvent) { LOG.info("Compile and evaluate current script buffer") Notifier.updateStatus("${Notifier.LONG_OPERATION_PREFIX}Compiling and performing current script") val editor = GuiRecorderManager.getEditor() diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/ShowGuiEditorWindowAction.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/ShowGuiEditorWindowAction.kt index 890e3c71ac42..8f93677c02a7 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/ShowGuiEditorWindowAction.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/ShowGuiEditorWindowAction.kt @@ -21,7 +21,7 @@ import com.intellij.testGuiFramework.recorder.GuiRecorderManager class ShowGuiEditorWindowAction : AnAction() { - override fun actionPerformed(p0: AnActionEvent?) { + override fun actionPerformed(p0: AnActionEvent) { val frame = GuiRecorderManager.frame if (!frame.isShowing) { StartPauseRecAction().setSelected(null, true) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/StopRecAction.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/StopRecAction.kt index e8c369d7ae36..988af6e50b89 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/StopRecAction.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/actions/StopRecAction.kt @@ -27,7 +27,7 @@ import com.intellij.testGuiFramework.recorder.ui.Notifier */ class StopRecAction : AnAction(null, "Stop Recording, Compiling, Running and Clear Buffer", AllIcons.Actions.Suspend) { - override fun actionPerformed(p0: AnActionEvent?) { + override fun actionPerformed(p0: AnActionEvent) { GlobalActionRecorder.deactivate() GuiRecorderManager.cancelCurrentTask() Notifier.updateStatus("Stopped") diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/SearchFieldAction.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/SearchFieldAction.java index e2ad9adbb6eb..3d4577cbb353 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/SearchFieldAction.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/SearchFieldAction.java @@ -16,7 +16,9 @@ package com.intellij.openapi.vcs.ui; import com.intellij.icons.AllIcons; +import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.actionSystem.ex.CustomComponentAction; import com.intellij.ui.SearchTextField; @@ -44,7 +46,7 @@ public abstract class SearchFieldAction extends AnAction implements CustomCompon if ((KeyEvent.VK_ENTER == e.getKeyCode()) || ('\n' == e.getKeyChar())) { e.consume(); addCurrentTextToHistory(); - actionPerformed(null); + perform(); } return super.preprocessEventForTextField(e); } @@ -52,12 +54,12 @@ public abstract class SearchFieldAction extends AnAction implements CustomCompon @Override protected void onFocusLost() { myField.addCurrentTextToHistory(); - actionPerformed(null); + perform(); } @Override protected void onFieldCleared() { - actionPerformed(null); + perform(); } }; Border border = myField.getBorder(); @@ -85,6 +87,10 @@ public abstract class SearchFieldAction extends AnAction implements CustomCompon myComponent.add(myField); } + private void perform() { + actionPerformed(AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataId -> null)); + } + public String getText() { return myField.getText(); } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java index 4df248ebbbc8..d6a8c9daf812 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java @@ -24,7 +24,6 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.ui.ClickListener; import com.intellij.util.ui.JBUI; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; @@ -49,14 +48,18 @@ public abstract class TextFieldAction extends AnAction implements CustomComponen public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { e.consume(); - actionPerformed(null); + perform(); } } }); } @Override - public abstract void actionPerformed(@Nullable AnActionEvent e); + public void actionPerformed(@NotNull AnActionEvent e) { + perform(); + } + + public void perform() {} @Override public JComponent createCustomComponent(Presentation presentation) { @@ -87,7 +90,7 @@ public abstract class TextFieldAction extends AnAction implements CustomComponen new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { - actionPerformed(null); + perform(); return true; } }.installOn(label); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt index f40684325a77..b55bc355248a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt @@ -537,7 +537,7 @@ class PartialLocalLineStatusTracker(project: Project, val moveChangesShortcutSet = ActionManager.getInstance().getAction("Vcs.MoveChangedLinesToChangelist").shortcutSet object : DumbAwareAction() { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { link.linkLabel.doClick() } }.registerCustomShortcutSet(moveChangesShortcutSet, editor.component, disposable) diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java index 1de5bf84c797..13f9bca3049b 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java @@ -559,7 +559,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo } } else { - createDefaultEditAction(project, producer).actionPerformed(null); + perform(project, producer); } } }; diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java index 2b2383310b18..48a94cc811bc 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java @@ -100,13 +100,15 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection } public static AnAction createDefaultEditAction(Project project, Factory producer) { - return DumbAwareAction.create(e -> { - BaseInjection originalInjection = producer.create(); - BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy()); - if (newInjection != null) { - originalInjection.copyFrom(newInjection); - } - }); + return DumbAwareAction.create(e -> perform(project, producer)); + } + + protected static void perform(Project project, Factory producer) { + BaseInjection originalInjection = producer.create(); + BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy()); + if (newInjection != null) { + originalInjection.copyFrom(newInjection); + } } public static AnAction createDefaultAddAction(final Project project, diff --git a/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjectionSupport.java b/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjectionSupport.java index 2464acf286fe..da7ac5f8f9c3 100644 --- a/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjectionSupport.java +++ b/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjectionSupport.java @@ -376,7 +376,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor } } else { - createDefaultEditAction(project, producer).actionPerformed(null); + perform(project, producer); } } }; diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserActionGroup.kt b/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserActionGroup.kt index f5304919bb0e..f997efd51292 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserActionGroup.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserActionGroup.kt @@ -34,9 +34,7 @@ import org.jetbrains.plugins.github.util.GithubUtil open class GithubOpenInBrowserActionGroup : ActionGroup("Open on GitHub", "Open corresponding link in browser", AllIcons.Vcs.Vendors.Github) { - override fun update(e: AnActionEvent?) { - if (e == null) return - + override fun update(e: AnActionEvent) { val repositories = getData(e.dataContext)?.first e.presentation.isEnabledAndVisible = repositories != null && repositories.isNotEmpty() } @@ -53,9 +51,7 @@ open class GithubOpenInBrowserActionGroup override fun isPopup(): Boolean = true - override fun actionPerformed(e: AnActionEvent?) { - if (e == null) return - + override fun actionPerformed(e: AnActionEvent) { getData(e.dataContext)?.let { GithubOpenInBrowserAction(it.first.first(), it.second) }?.actionPerformed(e) } diff --git a/plugins/github/src/org/jetbrains/plugins/github/LegacySingleAccountActionGroup.kt b/plugins/github/src/org/jetbrains/plugins/github/LegacySingleAccountActionGroup.kt index 32d210140241..80bdfaf9b657 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/LegacySingleAccountActionGroup.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/LegacySingleAccountActionGroup.kt @@ -20,8 +20,7 @@ import org.jetbrains.plugins.github.util.GithubGitHelper import javax.swing.Icon abstract class LegacySingleAccountActionGroup(text: String?, description: String?, icon: Icon?) : DumbAwareAction(text, description, icon) { - override fun update(e: AnActionEvent?) { - if (e == null) return + override fun update(e: AnActionEvent) { val project = e.getData(CommonDataKeys.PROJECT) val file = e.getData(CommonDataKeys.VIRTUAL_FILE) if (project == null || project.isDefault) { @@ -44,8 +43,7 @@ abstract class LegacySingleAccountActionGroup(text: String?, description: String e.presentation.isEnabledAndVisible = true } - override fun actionPerformed(e: AnActionEvent?) { - if (e == null) return + override fun actionPerformed(e: AnActionEvent) { val project = e.getData(CommonDataKeys.PROJECT) val file = e.getData(CommonDataKeys.VIRTUAL_FILE) if (project == null || project.isDefault) return diff --git a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountsPanel.kt b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountsPanel.kt index d70e2450e0ac..cc77256edd9d 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountsPanel.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountsPanel.kt @@ -75,7 +75,7 @@ internal class GithubAccountsPanel(private val project: Project, .setAddAction { addAccount() } .addExtraAction(object : ToolbarDecorator.ElementActionButton("Set default", AllIcons.Actions.Checked) { - override fun actionPerformed(e: AnActionEvent?) { + override fun actionPerformed(e: AnActionEvent) { if (accountList.selectedValue.projectDefault) return for (accountData in accountListModel.items) { if (accountData == accountList.selectedValue) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/ide/scripting.kt b/plugins/groovy/src/org/jetbrains/plugins/groovy/ide/scripting.kt index b03b50f7838e..c0c85fde12d7 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/ide/scripting.kt +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/ide/scripting.kt @@ -33,13 +33,13 @@ import javax.swing.JPanel class GroovyScriptingShellAction : AnAction() { - override fun actionPerformed(e: AnActionEvent?) { - val project = e?.project ?: return + override fun actionPerformed(e: AnActionEvent) { + val project = e.project ?: return initConsole(project) } - override fun update(e: AnActionEvent?) { - e?.presentation?.isEnabledAndVisible = ApplicationManager.getApplication().isInternal + override fun update(e: AnActionEvent) { + e.presentation.isEnabledAndVisible = ApplicationManager.getApplication().isInternal } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java index bb82a4eded8c..86e1f766ff1e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java @@ -7,6 +7,7 @@ import com.intellij.openapi.actionSystem.ex.CustomComponentAction; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -31,7 +32,7 @@ public abstract class MoreAction extends DumbAwareAction implements CustomCompon myPanel.setLayout(layout); myLoadMoreBtn = new JButton(name); myLoadMoreBtn.setMargin(JBUI.insets(2)); - myLoadMoreBtn.addActionListener(e -> this.actionPerformed(null)); + myLoadMoreBtn.addActionListener(__ -> perform()); myPanel.add(myLoadMoreBtn); myLabel = new JLabel("Loading..."); myLabel.setForeground(UIUtil.getInactiveTextColor()); @@ -59,4 +60,11 @@ public abstract class MoreAction extends DumbAwareAction implements CustomCompon public void setVisible(boolean b) { myVisible = b; } + + public abstract void perform(); + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + perform(); + } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java index c5b99a43f02d..570473c353cc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java @@ -395,7 +395,7 @@ public class ToBeMergedDialog extends DialogWrapper { } @Override - public void actionPerformed(AnActionEvent e) { + public void perform() { // TODO: This setVisible() is necessary because MoreXAction shows "Loading..." text when disabled myMore500Action.setVisible(false); myMore100Action.setEnabled(false); diff --git a/plugins/ui-designer-core/src/com/intellij/designer/actions/SelectAllAction.java b/plugins/ui-designer-core/src/com/intellij/designer/actions/SelectAllAction.java index 26e4855fcf5e..3a6d02e8a16d 100644 --- a/plugins/ui-designer-core/src/com/intellij/designer/actions/SelectAllAction.java +++ b/plugins/ui-designer-core/src/com/intellij/designer/actions/SelectAllAction.java @@ -37,6 +37,10 @@ public class SelectAllAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { + perform(); + } + + public void perform() { RadComponent rootComponent = myArea.getRootComponent(); if (rootComponent != null) { final List components = new ArrayList<>(); diff --git a/plugins/ui-designer-core/src/com/intellij/designer/componentTree/ComponentTree.java b/plugins/ui-designer-core/src/com/intellij/designer/componentTree/ComponentTree.java index c128c8110497..d094e29ee1d3 100644 --- a/plugins/ui-designer-core/src/com/intellij/designer/componentTree/ComponentTree.java +++ b/plugins/ui-designer-core/src/com/intellij/designer/componentTree/ComponentTree.java @@ -18,6 +18,7 @@ package com.intellij.designer.componentTree; import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; import com.intellij.designer.actions.DesignerActionPanel; +import com.intellij.designer.actions.SelectAllAction; import com.intellij.designer.actions.StartInplaceEditing; import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.EditableArea; @@ -84,7 +85,7 @@ public final class ComponentTree extends Tree implements DataProvider { @Override public void actionPerformed(ActionEvent e) { if (myDesigner != null) { - myDesigner.getActionPanel().createSelectAllAction(myDesigner.getSurfaceArea()).actionPerformed(null); + ((SelectAllAction)myDesigner.getActionPanel().createSelectAllAction(myDesigner.getSurfaceArea())).perform(); } } }); diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyUnwrapperTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyUnwrapperTest.java index 888741a2e002..a45d465f4bce 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyUnwrapperTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyUnwrapperTest.java @@ -68,7 +68,7 @@ public class PyUnwrapperTest extends PyTestCase { myFixture.configureByFile(before); UnwrapHandler h = new UnwrapHandler() { @Override - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { assertTrue("No available options to unwrap", !options.isEmpty()); options.get(option).actionPerformed(null); } @@ -84,7 +84,7 @@ public class PyUnwrapperTest extends PyTestCase { myFixture.configureByFile(before); UnwrapHandler h = new UnwrapHandler() { @Override - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { assertEmpty(options); } }; @@ -96,7 +96,7 @@ public class PyUnwrapperTest extends PyTestCase { myFixture.configureByFile(before); UnwrapHandler h = new UnwrapHandler() { @Override - protected void selectOption(List options, Editor editor, PsiFile file) { + protected void selectOption(List options, Editor editor, PsiFile file) { for (AnAction option : options) { assertFalse("\"" + optionName + "\" is available to unwrap ", option.toString().contains(optionName)); } diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/SurroundWithEmmetAction.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/SurroundWithEmmetAction.java index 3bb2d91e63c6..cfae66921c97 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/SurroundWithEmmetAction.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/SurroundWithEmmetAction.java @@ -57,7 +57,7 @@ public class SurroundWithEmmetAction extends BaseCodeInsightAction { ZenCodingTemplate emmetCustomTemplate = CustomLiveTemplate.EP_NAME.findExtension(ZenCodingTemplate.class); if (emmetCustomTemplate != null) { - new WrapWithCustomTemplateAction(emmetCustomTemplate, editor, file, ContainerUtil.newHashSet()).actionPerformed(null); + new WrapWithCustomTemplateAction(emmetCustomTemplate, editor, file, ContainerUtil.newHashSet()).perform(); } else if (!ApplicationManager.getApplication().isUnitTestMode()) { HintManager.getInstance().showErrorHint(editor, "Cannot invoke Surround with Emmet in the current context");