Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindReplaceOverlay: Add "skip replace" button #2507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private FindReplaceMessages() {
public static String FindReplace_WholeWordCheckBox_label;
public static String FindReplace_IncrementalCheckBox_label;
public static String FindReplace_RegExCheckbox_label;
public static String FindReplaceOverlay_skipReplaceButton_toolTip;
public static String FindReplace_FindNextButton_label;
public static String FindReplace_ReplaceFindButton_label;
public static String FindReplace_ReplaceSelectionButton_label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ FindReplaceOverlay_regexSearchButton_toolTip=Match regular expression pattern
FindReplaceOverlay_caseSensitiveButton_toolTip=Match case
FindReplaceOverlay_wholeWordsButton_toolTip=Match whole word
FindReplaceOverlay_replaceButton_toolTip=Replace
FindReplaceOverlay_skipReplaceButton_toolTip=Don't replace this occurrence and jump to the next
FindReplaceOverlay_replaceAllButton_toolTip=Replace all
FindReplaceOverlay_searchBar_message=Find (\u2195 for history)
FindReplaceOverlay_replaceBar_message=Replace (\u2195 for history)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private final class KeyboardShortcuts {
KeyStroke.getInstance(SWT.MOD1, 'f'));
private static final List<KeyStroke> TOGGLE_REPLACE = List.of( //
KeyStroke.getInstance(SWT.MOD1, 'R'), KeyStroke.getInstance(SWT.MOD1, 'r'));
public static final List<KeyStroke> SKIP_REPLACE = List.of( //
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'O'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'o'));
}

public static final String ID_DATA_KEY = "org.eclipse.ui.internal.findreplace.overlay.FindReplaceOverlay.id"; //$NON-NLS-1$
Expand Down Expand Up @@ -136,6 +138,7 @@ private final class KeyboardShortcuts {
private Composite replaceBarContainer;
private HistoryTextWrapper replaceBar;
private AccessibleToolBar replaceTools;
private ToolItem skipReplaceButton;
private ToolItem replaceButton;
private ToolItem replaceAllButton;

Expand Down Expand Up @@ -291,6 +294,7 @@ private void assignIDs() {

if (replaceBarOpen) {
replaceBar.setData(ID_DATA_KEY, "replaceInput");
skipReplaceButton.setData(ID_DATA_KEY, "skipReplace");
replaceButton.setData(ID_DATA_KEY, "replaceOne");
replaceAllButton.setData(ID_DATA_KEY, "replaceAll");
}
Expand Down Expand Up @@ -511,6 +515,12 @@ private void createReplaceTools() {
replaceTools.createToolItem(SWT.SEPARATOR);

GridDataFactory.fillDefaults().grab(false, true).align(GridData.CENTER, GridData.END).applyTo(replaceTools);

skipReplaceButton = new AccessibleToolItemBuilder(replaceTools).withStyleBits(SWT.PUSH)
.withImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_SKIP_REPLACE))
.withToolTipText(FindReplaceMessages.FindReplaceOverlay_skipReplaceButton_toolTip)
.withOperation(() -> performSearch(true)).withShortcuts(KeyboardShortcuts.SKIP_REPLACE).build();

replaceButton = new AccessibleToolItemBuilder(replaceTools).withStyleBits(SWT.PUSH)
.withImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_REPLACE))
.withToolTipText(FindReplaceMessages.FindReplaceOverlay_replaceButton_toolTip)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class FindReplaceOverlayImages {
static final String KEY_OPEN_REPLACE_AREA = PREFIX_ELCL + "open_replace"; //$NON-NLS-1$
static final String KEY_CLOSE_REPLACE_AREA = PREFIX_ELCL + "close_replace"; //$NON-NLS-1$
static final String KEY_OPEN_HISTORY = "open_history"; //$NON-NLS-1$
public static final String KEY_SKIP_REPLACE = PREFIX_ELCL + "skip_replace"; //$NON-NLS-1$

/**
* The image registry containing {@link Image images}.
Expand Down Expand Up @@ -74,6 +75,7 @@ private static void declareImages() {
declareRegistryImage(KEY_OPEN_REPLACE_AREA, ELCL + "open_replace.png"); //$NON-NLS-1$
declareRegistryImage(KEY_CLOSE_REPLACE_AREA, ELCL + "close_replace.png"); //$NON-NLS-1$
declareRegistryImage(KEY_OPEN_HISTORY, ELCL + "open_history.png"); //$NON-NLS-1$
declareRegistryImage(KEY_SKIP_REPLACE, ELCL + "skip_replace.png"); //$NON-NLS-1$
}

/**
Expand Down
Loading