From af0883797724cd48171e3a117b7eb7a68ab979e7 Mon Sep 17 00:00:00 2001 From: "Evgeniy.Stepanov" Date: Mon, 26 Dec 2016 14:53:00 +0100 Subject: [PATCH] Remove action from recent panel UI list --- .../src/com/intellij/ide/ReopenProjectAction.java | 2 ++ .../wm/impl/welcomeScreen/RecentProjectPanel.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java b/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java index 7a5b68a3d44e..f66c8c890255 100644 --- a/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java +++ b/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java @@ -45,6 +45,7 @@ public class ReopenProjectAction extends AnAction implements DumbAware { presentation.setDescription(projectPath); } + public Boolean IsRemoved = false; @Override public void actionPerformed(AnActionEvent e) { @@ -61,6 +62,7 @@ public class ReopenProjectAction extends AnAction implements DumbAware { if (Messages.showDialog(project, "The path " + FileUtil.toSystemDependentName(myProjectPath) + " does not exist.\n" + "If it is on a removable or network drive, please make sure that the drive is connected.", "Reopen Project", new String[]{"OK", "&Remove From List"}, 0, Messages.getErrorIcon()) == 1) { + IsRemoved = true; RecentProjectsManager.getInstance().removePath(myProjectPath); } return; 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 817d389cdac6..bb91ed0c1883 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 @@ -122,8 +122,16 @@ public class RecentProjectPanel extends JPanel { if (Registry.is("removable.welcome.screen.projects") && rectInListCoordinatesContains(cellBounds, event.getPoint())) { removeRecentProjectAction.actionPerformed(null); } else if (selection != null) { - ((AnAction)selection).actionPerformed( - AnActionEvent.createFromInputEvent((AnAction)selection, event, ActionPlaces.WELCOME_SCREEN)); + AnAction selectedAction = (AnAction) selection; + AnActionEvent actionEvent = AnActionEvent.createFromInputEvent(selectedAction, event, ActionPlaces.WELCOME_SCREEN); + selectedAction.actionPerformed(actionEvent); + + // remove action from list if needed + if (selectedAction instanceof ReopenProjectAction) { + if (((ReopenProjectAction)selectedAction).IsRemoved) { + ListUtil.removeSelectedItems(myList); + } + } } } }