welcome screen: VCS popup shows at left under the label clion/140.244 dbe/140.247 pycharm/140.242 rubymine/140.248 webstorm/140.246
authorKonstantin Bulenkov <kb@jetbrains.com>
Thu, 23 Oct 2014 22:52:37 +0000 (00:52 +0200)
committerKonstantin Bulenkov <kb@jetbrains.com>
Thu, 23 Oct 2014 22:52:37 +0000 (00:52 +0200)
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomePopupAction.java

index f4bf58990d02d3d5db18bc2b542721a71f67db3e..564206931b40c519445c0fe18e706f7da514bb30 100644 (file)
@@ -429,7 +429,14 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame {
         public void keyPressed(KeyEvent e) {
           final JList list = UIUtil.findComponentOfType(FlatWelcomeFrame.this.getComponent(), JList.class);
           if (e.getKeyCode() == KeyEvent.VK_ENTER) {
-            action.actionPerformed(new AnActionEvent(e,
+            InputEvent event = e;
+            if (e.getComponent() instanceof JComponent) {
+              ActionLink link = UIUtil.findComponentOfType((JComponent)e.getComponent(), ActionLink.class);
+              if (link != null) {
+                event = new MouseEvent(link, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), 0, 0, 1, false, MouseEvent.BUTTON1);
+              }
+            }
+            action.actionPerformed(new AnActionEvent(event,
                                                      DataManager.getInstance().getDataContext(),
                                                      ActionPlaces.WELCOME_SCREEN,
                                                      action.getTemplatePresentation().clone(),
index d1f6ecd3c4f4b57560f15b88155ea5804881a5cd..7e407a63f03b29391f09d226f50d0ab53b7d3f07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.ui.popup.ListPopup;
 import com.intellij.openapi.wm.ex.WindowManagerEx;
+import com.intellij.ui.popup.PopupFactoryImpl;
 
 import javax.swing.*;
 import java.awt.*;
@@ -92,7 +93,11 @@ public abstract class WelcomePopupAction extends AnAction implements DumbAware {
   protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
     Component focusedComponent = contextComponent != null ? contextComponent : PlatformDataKeys.CONTEXT_COMPONENT.getData(context);
     if (focusedComponent != null) {
-      popup.showUnderneathOf(focusedComponent);
+      if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
+        ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
+      } else {
+        popup.showUnderneathOf(focusedComponent);
+      }
     }
     else {
       Rectangle r;