mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-70225 No tooltip on gear icon in find toolbar; IDEA-69686: preserve case from keyboard.
This commit is contained in:
@@ -27,6 +27,7 @@ import com.intellij.find.impl.livePreview.LivePreview;
|
||||
import com.intellij.find.impl.livePreview.LivePreviewControllerBase;
|
||||
import com.intellij.find.impl.livePreview.SearchResults;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
@@ -261,6 +262,9 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
myActionsGroup.add(new ToggleMatchCase(this));
|
||||
myActionsGroup.add(new ToggleRegex(this));
|
||||
|
||||
myActionsToolbar = ActionManager.getInstance().createActionToolbar("SearchBar", myActionsGroup, true);
|
||||
myActionsToolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");
|
||||
|
||||
myActionsGroup.addAction(new ToggleWholeWordsOnlyAction(this));
|
||||
if (FindManagerImpl.ourHasSearchInCommentsAndLiterals) {
|
||||
myActionsGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true);
|
||||
@@ -269,14 +273,19 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
myActionsGroup.addAction(new TogglePreserveCaseAction(this)).setAsSecondary(true);
|
||||
myActionsGroup.addAction(new ToggleSelectionOnlyAction(this));
|
||||
|
||||
myActionsToolbar = ActionManager.getInstance().createActionToolbar("SearchBar", myActionsGroup, true);
|
||||
|
||||
myActionsToolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY);
|
||||
myToolbarComponent = myActionsToolbar.getComponent();
|
||||
myToolbarComponent.setBorder(null);
|
||||
myToolbarComponent.setOpaque(false);
|
||||
|
||||
myLeadPanel.add(myToolbarComponent);
|
||||
|
||||
if (myToolbarComponent instanceof ActionToolbarImpl) {
|
||||
new ShowMoreOptions(myToolbarComponent, mySearchField);
|
||||
}
|
||||
|
||||
|
||||
JPanel tailPanel = new NonOpaquePanel(new BorderLayout(5, 0));
|
||||
JPanel tailContainer = new NonOpaquePanel(new BorderLayout(5, 0));
|
||||
tailContainer.add(tailPanel, BorderLayout.EAST);
|
||||
@@ -443,6 +452,9 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
myReplacementPane = createLeadPane();
|
||||
myReplaceField = createTextField(myReplacementPane);
|
||||
|
||||
if (myToolbarComponent instanceof ActionToolbarImpl) {
|
||||
new ShowMoreOptions(myToolbarComponent, myReplaceField);
|
||||
}
|
||||
|
||||
DocumentListener replaceFieldListener = new DocumentListener() {
|
||||
@Override
|
||||
@@ -617,7 +629,6 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
}
|
||||
});
|
||||
new CloseOnESCAction(this, editorTextField);
|
||||
|
||||
return editorTextField;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButton;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 25.05.11
|
||||
* Time: 22:24
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ShowMoreOptions extends AnAction {
|
||||
private JComponent myToolbarComponent;
|
||||
public static final Shortcut SHORT_CUT = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.ALT_DOWN_MASK), null);
|
||||
|
||||
public ShowMoreOptions(JComponent toolbarComponent, JTextComponent searchField) {
|
||||
this.myToolbarComponent = toolbarComponent;
|
||||
registerCustomShortcutSet(new CustomShortcutSet(SHORT_CUT), searchField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final ActionButton secondaryActions = ((ActionToolbarImpl)myToolbarComponent).getSecondaryActionsButton();
|
||||
if (secondaryActions != null) {
|
||||
secondaryActions.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class TogglePreserveCaseAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
private static final String TEXT = "Preserve Case";
|
||||
private static final String TEXT = "&Preserve Case";
|
||||
|
||||
public TogglePreserveCaseAction(EditorSearchComponent editorSearchComponent) {
|
||||
super(editorSearchComponent, TEXT);
|
||||
|
||||
+10
-5
@@ -88,19 +88,24 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
|
||||
private static final Icon myAutoPopupIcon = IconLoader.getIcon("/ide/link.png");
|
||||
private static final Icon mySecondaryGroupIcon = IconLoader.getIcon("/general/secondaryGroup.png");
|
||||
|
||||
private final DefaultActionGroup mySecondaryActions = new DefaultActionGroup();
|
||||
|
||||
public ActionButton getSecondaryActionsButton() {
|
||||
return mySecondaryActionsButton;
|
||||
}
|
||||
|
||||
private ActionButton mySecondaryActionsButton;
|
||||
|
||||
private final KeymapManagerEx myKeymapManager;
|
||||
|
||||
private int myFirstOusideIndex = -1;
|
||||
|
||||
private JBPopup myPopup;
|
||||
private JComponent myTargetComponent;
|
||||
|
||||
private JComponent myTargetComponent;
|
||||
private boolean myReservePlaceAutoPopupIcon = true;
|
||||
|
||||
private WeakTimerListener myWeakTimerListener;
|
||||
@SuppressWarnings({"FieldCanBeLocal"}) private ActionToolbarImpl.MyTimerListener myTimerListener;
|
||||
|
||||
public ActionToolbarImpl(final String place,
|
||||
@NotNull final ActionGroup actionGroup,
|
||||
final boolean horizontal,
|
||||
@@ -155,7 +160,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
myActionManager.addTimerListener(500, myWeakTimerListener);
|
||||
myActionManager.addTransparrentTimerListener(500, myWeakTimerListener);
|
||||
}
|
||||
|
||||
|
||||
private boolean doMacEnhancementsForMainToolbar() {
|
||||
return UIUtil.isUnderAquaLookAndFeel() && ActionPlaces.MAIN_TOOLBAR.equals(myPlace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user