diff --git a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java index 4472e94a6ec..fab9092948b 100644 --- a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java +++ b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java @@ -314,15 +314,20 @@ private void createContainerAndSearchControls(Composite parent) { } retrieveBackgroundColor(); createMainContainer(parent); - initializeSearchShortcutHandlers(); + initializeShortcutHandlers(); + setReplaceVisible(false); containerControl.layout(); } - private void initializeSearchShortcutHandlers() { + private void initializeShortcutHandlers() { searchTools.registerActionShortcutsAtControl(searchBar); closeTools.registerActionShortcutsAtControl(searchBar); replaceToggleTools.registerActionShortcutsAtControl(searchBar); + + replaceTools.registerActionShortcutsAtControl(replaceBar); + closeTools.registerActionShortcutsAtControl(replaceBar); + replaceToggleTools.registerActionShortcutsAtControl(replaceBar); } /** @@ -409,6 +414,7 @@ private void createContentsContainer() { GridDataFactory.fillDefaults().grab(true, true).align(GridData.FILL, GridData.FILL).applyTo(contentGroup); createSearchContainer(); + createReplaceContainer(); } private void createSearchTools() { @@ -647,7 +653,7 @@ private void createReplaceContainer() { private void setReplaceVisible(boolean visible) { if (findReplaceLogic.getTarget().isEditable() && visible) { - createReplaceDialog(); + showReplace(); replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_CLOSE_REPLACE_AREA)); } else { hideReplace(); @@ -661,31 +667,23 @@ private void hideReplace() { return; } searchBar.forceFocus(); - contentAssistReplaceField = null; replaceBarOpen = false; - replaceContainer.dispose(); + ((GridData) replaceContainer.getLayoutData()).exclude = true; + replaceContainer.setVisible(false); updatePlacementAndVisibility(); } - private void createReplaceDialog() { + private void showReplace() { if (replaceBarOpen) { return; } replaceBarOpen = true; - createReplaceContainer(); - initializeReplaceShortcutHandlers(); - + ((GridData) replaceContainer.getLayoutData()).exclude = false; + replaceContainer.setVisible(true); updatePlacementAndVisibility(); - assignIDs(); replaceBar.forceFocus(); } - private void initializeReplaceShortcutHandlers() { - replaceTools.registerActionShortcutsAtControl(replaceBar); - closeTools.registerActionShortcutsAtControl(replaceBar); - replaceToggleTools.registerActionShortcutsAtControl(replaceBar); - } - private void enableSearchTools(boolean enable) { ((GridData) searchTools.getLayoutData()).exclude = !enable; searchTools.setVisible(enable);