import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFocusManager;
-import com.intellij.ui.*;
+import com.intellij.ui.DocumentAdapter;
+import com.intellij.ui.LightColors;
+import com.intellij.ui.OnePixelSplitter;
+import com.intellij.ui.SearchTextField;
import com.intellij.ui.components.JBList;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
initUI();
new SwitchToFind(this);
- new SwitchToReplace(this, editor);
+ new SwitchToReplace(this);
myFindModel.addObserver(new FindModel.FindModelObserver() {
@Override
Wrapper searchToolbarWrapper1 = new NonOpaquePanel(new BorderLayout());
searchToolbarWrapper1.add(mySearchActionsToolbar1, BorderLayout.WEST);
Wrapper searchToolbarWrapper2 = new Wrapper(mySearchActionsToolbar2);
+ mySearchActionsToolbar2.setBorder(JBUI.Borders.empty(0, 16, 0, 0));
JPanel searchPair = new NonOpaquePanel(new BorderLayout()).setVerticalSizeReferent(mySearchFieldWrapper);
- searchPair.add(mySearchActionsToolbar1, BorderLayout.WEST);
+ searchPair.add(searchToolbarWrapper1, BorderLayout.WEST);
searchPair.add(searchToolbarWrapper2, BorderLayout.CENTER);
JLabel closeLabel = new JLabel(null, AllIcons.Actions.Cross, SwingConstants.RIGHT);
closeLabel.setBorder(JBUI.Borders.empty(5, 5, 5, 5));
Wrapper replaceToolbarWrapper1 = new Wrapper(myReplaceActionsToolbar1).setVerticalSizeReferent(myReplaceFieldWrapper);
Wrapper replaceToolbarWrapper2 = new Wrapper(myReplaceActionsToolbar2).setVerticalSizeReferent(myReplaceFieldWrapper);
+ myReplaceActionsToolbar2.setBorder(JBUI.Borders.empty(0, 16, 0, 0));
+
myReplaceToolbarWrapper = new NonOpaquePanel(new BorderLayout());
myReplaceToolbarWrapper.add(replaceToolbarWrapper1, BorderLayout.WEST);
myReplaceToolbarWrapper.add(replaceToolbarWrapper2, BorderLayout.CENTER);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- @Override
- public void run() {
- searchFieldDocumentChanged();
- }
- });
+ searchFieldDocumentChanged();
}
});
}
new RestorePreviousSettingsAction(this, mySearchTextComponent);
new VariantsCompletionAction(mySearchTextComponent); // It registers a shortcut set automatically on construction
}
+
private void searchFieldDocumentChanged() {
setMatchesLimit(LivePreviewController.MATCHES_LIMIT);
String text = mySearchTextComponent.getText();
DefaultActionGroup actionGroup1 = new DefaultActionGroup("replace bar 1", false);
myReplaceActionsToolbar1 = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, actionGroup1, true);
myReplaceActionsToolbar1.setForceMinimumSize(true);
+ myReplaceActionsToolbar1.setReservePlaceAutoPopupIcon(false);
final JButton myReplaceButton = new JButton("Replace");
myReplaceButton.setFocusable(false);
myReplaceButton.addActionListener(new ActionListener() {
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
/**
* To change this template use File | Settings | File Templates.
*/
public class SwitchToReplace extends EditorHeaderAction {
- private final Editor myEditor;
- public SwitchToReplace(EditorSearchComponent editorSearchComponent, Editor editor) {
+ public SwitchToReplace(EditorSearchComponent editorSearchComponent) {
super(editorSearchComponent);
- myEditor = editor;
AnAction replaceAction = ActionManager.getInstance().getAction("Replace");
if (replaceAction != null) {
registerCustomShortcutSet(replaceAction.getShortcutSet(), editorSearchComponent);
@Override
public void update(AnActionEvent e) {
- e.getPresentation().setEnabled(!ConsoleViewUtil.isConsoleViewEditor(myEditor));
+ final Editor editor = CommonDataKeys.EDITOR_EVEN_IF_INACTIVE.getData(e.getDataContext());
+ e.getPresentation().setEnabled(editor != null && !ConsoleViewUtil.isConsoleViewEditor(editor));
}
@Override