IDEA-140057 Pin/unpin buttons of the "Quick Documentation/Definition" popup are too different and thus very confusing

This commit is contained in:
Dmitry Batrak
2015-09-01 15:44:58 +03:00
parent 0b0edaa267
commit 3e8e62afe2
8 changed files with 18 additions and 7 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

@@ -28,6 +28,7 @@ import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowType;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.ToolWindowEx;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
@@ -105,6 +106,8 @@ public abstract class DockablePopupManager<T extends JComponent & Disposable> {
final Rectangle rectangle = WindowManager.getInstance().getIdeFrame(myProject).suggestChildFrameBounds();
myToolWindow.setDefaultState(ToolWindowAnchor.RIGHT, ToolWindowType.FLOATING, rectangle);
((ToolWindowEx)myToolWindow).setTitleActions(createRestorePopupAction());
final ContentManager contentManager = myToolWindow.getContentManager();
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
@@ -152,12 +155,12 @@ public abstract class DockablePopupManager<T extends JComponent & Disposable> {
restartAutoUpdate(state);
}
};
return new AnAction[]{toggleAutoUpdateAction, createRestorePopupAction()};
return new AnAction[]{toggleAutoUpdateAction};
}
@NotNull
protected AnAction createRestorePopupAction() {
return new AnAction("Restore Popup", getRestorePopupDescription(), AllIcons.Actions.Cancel) {
return new AnAction("Restore Popup", getRestorePopupDescription(), AllIcons.General.AutohideOffPressed) {
@Override
public void actionPerformed(AnActionEvent e) {
restorePopupBehavior();
@@ -107,6 +107,8 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
private ActionCallback myLastAction;
private DocumentationComponent myTestDocumentationComponent;
private AnAction myRestorePopupAction;
@Override
protected String getToolwindowId() {
@@ -136,10 +138,8 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
@NotNull
@Override
protected AnAction createRestorePopupAction() {
AnAction restorePopupAction = super.createRestorePopupAction();
ShortcutSet quickDocShortcut = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet();
restorePopupAction.registerCustomShortcutSet(quickDocShortcut, null);
return restorePopupAction;
myRestorePopupAction = super.createRestorePopupAction();
return myRestorePopupAction;
}
@Override
@@ -157,6 +157,12 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
if (myToolWindow != null) {
myToolWindow.getComponent().putClientProperty(ChooseByNameBase.TEMPORARILY_FOCUSABLE_COMPONENT_KEY, Boolean.TRUE);
if (myRestorePopupAction != null) {
ShortcutSet quickDocShortcut = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet();
myRestorePopupAction.registerCustomShortcutSet(quickDocShortcut, myToolWindow.getComponent());
myRestorePopupAction = null;
}
}
}
@@ -266,7 +266,8 @@ public class AbstractPopup implements JBPopup {
if (pinCallback != null) {
myCaption.setButtonComponent(new InplaceButton(
new IconButton("Pin", AllIcons.General.AutohideOff, AllIcons.General.AutohideOff, AllIcons.General.AutohideOffInactive),
new IconButton("Open as Tool Window",
AllIcons.General.AutohideOff, AllIcons.General.AutohideOff, AllIcons.General.AutohideOffInactive),
new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
@@ -379,6 +379,7 @@ public class AllIcons {
public static final Icon ArrowDown = IconLoader.getIcon("/general/arrowDown.png"); // 7x6
public static final Icon AutohideOff = IconLoader.getIcon("/general/autohideOff.png"); // 14x14
public static final Icon AutohideOffInactive = IconLoader.getIcon("/general/autohideOffInactive.png"); // 14x14
public static final Icon AutohideOffPressed = IconLoader.getIcon("/general/autohideOffPressed.png"); // 22x20
public static final Icon AutoscrollFromSource = IconLoader.getIcon("/general/autoscrollFromSource.png"); // 16x16
public static final Icon AutoscrollToSource = IconLoader.getIcon("/general/autoscrollToSource.png"); // 16x16
public static final Icon Balloon = IconLoader.getIcon("/general/balloon.png"); // 16x16