Remove action from recent panel UI list

This commit is contained in:
Evgeniy.Stepanov
2017-01-25 10:49:57 +01:00
parent edf7eb650c
commit af08837977
2 changed files with 12 additions and 2 deletions
@@ -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;
@@ -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);
}
}
}
}
}