Skip to content

Commit

Permalink
Clean Up Find Replace Overlay Icons
Browse files Browse the repository at this point in the history
- The icons are part of a local toolbar. Therefore move them from the
  "obj" folder to the "lcl16" folder.
- Fix file name for high resolution icons for select_prev and
  select_prev icons
- Make more clear what's the file name of and icon and what's it's key

Fixes: eclipse-platform#1977
  • Loading branch information
BeckerWdf committed Jun 18, 2024
1 parent 827687f commit c93e6c3
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,22 +435,22 @@ private void createSearchTools() {
ToolItem separator = new ToolItem(searchTools, SWT.SEPARATOR);

searchUpButton = new ToolItem(searchTools, SWT.PUSH);
searchUpButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_FIND_PREV));
searchUpButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_FIND_PREV));
searchUpButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_upSearchButton_toolTip);
searchUpButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
performSearch(false);
evaluateFindReplaceStatus();
}));
searchDownButton = new ToolItem(searchTools, SWT.PUSH);
searchDownButton.setSelection(true); // by default, search down
searchDownButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_FIND_NEXT));
searchDownButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_FIND_NEXT));
searchDownButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_downSearchButton_toolTip);
searchDownButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
performSearch(true);
evaluateFindReplaceStatus();
}));
searchAllButton = new ToolItem(searchTools, SWT.PUSH);
searchAllButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_SEARCH_ALL));
searchAllButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_SEARCH_ALL));
searchAllButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_searchAllButton_toolTip);
searchAllButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
performSelectAll();
Expand All @@ -460,7 +460,7 @@ private void createSearchTools() {

private void createAreaSearchButton() {
searchInSelectionButton = new ToolItem(searchTools, SWT.CHECK);
searchInSelectionButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_SEARCH_IN_AREA));
searchInSelectionButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_SEARCH_IN_AREA));
searchInSelectionButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_searchInSelectionButton_toolTip);
searchInSelectionButton.setSelection(findReplaceLogic.isActive(SearchOptions.WHOLE_WORD));
searchInSelectionButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
Expand All @@ -471,7 +471,7 @@ private void createAreaSearchButton() {

private void createRegexSearchButton() {
regexSearchButton = new ToolItem(searchTools, SWT.CHECK);
regexSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_FIND_REGEX));
regexSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_FIND_REGEX));
regexSearchButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_regexSearchButton_toolTip);
regexSearchButton.setSelection(findReplaceLogic.isActive(SearchOptions.REGEX));
regexSearchButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
Expand All @@ -483,7 +483,7 @@ private void createRegexSearchButton() {

private void createCaseSensitiveButton() {
caseSensitiveSearchButton = new ToolItem(searchTools, SWT.CHECK);
caseSensitiveSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_CASE_SENSITIVE));
caseSensitiveSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_CASE_SENSITIVE));
caseSensitiveSearchButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_caseSensitiveButton_toolTip);
caseSensitiveSearchButton.setSelection(findReplaceLogic.isActive(SearchOptions.CASE_SENSITIVE));
caseSensitiveSearchButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
Expand All @@ -494,7 +494,7 @@ private void createCaseSensitiveButton() {

private void createWholeWordsButton() {
wholeWordSearchButton = new ToolItem(searchTools, SWT.CHECK);
wholeWordSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_WHOLE_WORD));
wholeWordSearchButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_WHOLE_WORD));
wholeWordSearchButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_wholeWordsButton_toolTip);
wholeWordSearchButton.setSelection(findReplaceLogic.isActive(SearchOptions.WHOLE_WORD));
wholeWordSearchButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
Expand All @@ -509,7 +509,7 @@ private void createReplaceTools() {
replaceTools = new ToolBar(replaceContainer, SWT.HORIZONTAL);
GridDataFactory.fillDefaults().grab(false, true).align(GridData.CENTER, GridData.END).applyTo(replaceTools);
replaceButton = new ToolItem(replaceTools, SWT.PUSH);
replaceButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_REPLACE));
replaceButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_REPLACE));
replaceButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_replaceButton_toolTip);
replaceButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
if (getFindString().isEmpty()) {
Expand All @@ -520,7 +520,7 @@ private void createReplaceTools() {
evaluateFindReplaceStatus();
}));
replaceAllButton = new ToolItem(replaceTools, SWT.PUSH);
replaceAllButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_REPLACE_ALL));
replaceAllButton.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_REPLACE_ALL));
replaceAllButton.setToolTipText(FindReplaceMessages.FindReplaceOverlay_replaceAllButton_toolTip);
replaceAllButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
if (getFindString().isEmpty()) {
Expand Down Expand Up @@ -629,17 +629,17 @@ private void createReplaceToggle() {
GridDataFactory.fillDefaults().grab(false, true).align(GridData.BEGINNING, GridData.FILL)
.applyTo(replaceToggle);
replaceToggle.setToolTipText(FindReplaceMessages.FindReplaceOverlay_replaceToggle_toolTip);
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_OPEN_REPLACE_AREA));
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_OPEN_REPLACE_AREA));
replaceToggle.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> toggleReplace()));
}

private void toggleReplace() {
if (!replaceBarOpen) {
createReplaceDialog();
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_CLOSE_REPLACE_AREA));
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_CLOSE_REPLACE_AREA));
} else {
hideReplace();
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.OBJ_OPEN_REPLACE_AREA));
replaceToggle.setImage(FindReplaceOverlayImages.get(FindReplaceOverlayImages.KEY_OPEN_REPLACE_AREA));
}
replaceToggle.setSelection(false); // We don't want the button to look "locked in", so don't
// use it's selectionState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,19 @@
* find/replace-operations.
*/
class FindReplaceOverlayImages {
static final String PREFIX_OBJ = TextEditorPlugin.PLUGIN_ID + ".obj."; //$NON-NLS-1$

static final String OBJ_FIND_NEXT = PREFIX_OBJ + "select_next.png"; //$NON-NLS-1$

static final String OBJ_FIND_PREV = PREFIX_OBJ + "select_prev.png"; //$NON-NLS-1$

static final String OBJ_FIND_REGEX = PREFIX_OBJ + "regex_gear.gif"; //$NON-NLS-1$

static final String OBJ_REPLACE = PREFIX_OBJ + "replace.png"; //$NON-NLS-1$

static final String OBJ_REPLACE_ALL = PREFIX_OBJ + "replace_all.png"; //$NON-NLS-1$

static final String OBJ_WHOLE_WORD = PREFIX_OBJ + "whole_word.png"; //$NON-NLS-1$

static final String OBJ_CASE_SENSITIVE = PREFIX_OBJ + "case_sensitive.png"; //$NON-NLS-1$

static final String OBJ_SEARCH_ALL = PREFIX_OBJ + "search_all.png"; //$NON-NLS-1$

static final String OBJ_SEARCH_IN_AREA = PREFIX_OBJ + "search_in_selection.png"; //$NON-NLS-1$

static final String OBJ_OPEN_REPLACE_AREA = PREFIX_OBJ + "open_replace.png"; //$NON-NLS-1$

static final String OBJ_CLOSE_REPLACE_AREA = PREFIX_OBJ + "close_replace.png"; //$NON-NLS-1$
private static final String PREFIX_ELCL = TextEditorPlugin.PLUGIN_ID + ".elcl."; //$NON-NLS-1$

static final String KEY_FIND_NEXT = PREFIX_ELCL + "select_next"; //$NON-NLS-1$
static final String KEY_FIND_PREV = PREFIX_ELCL + "select_prev"; //$NON-NLS-1$
static final String KEY_FIND_REGEX = PREFIX_ELCL + "regex"; //$NON-NLS-1$
static final String KEY_REPLACE = PREFIX_ELCL + "replace"; //$NON-NLS-1$
static final String KEY_REPLACE_ALL = PREFIX_ELCL + "replace_all"; //$NON-NLS-1$
static final String KEY_WHOLE_WORD = PREFIX_ELCL + "whole_word"; //$NON-NLS-1$
static final String KEY_CASE_SENSITIVE = PREFIX_ELCL + "case_sensitive"; //$NON-NLS-1$
static final String KEY_SEARCH_ALL = PREFIX_ELCL + "search_all"; //$NON-NLS-1$
static final String KEY_SEARCH_IN_AREA = PREFIX_ELCL + "search_in_selection"; //$NON-NLS-1$
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$

/**
* The image registry containing {@link Image images}.
Expand All @@ -64,23 +54,23 @@ class FindReplaceOverlayImages {

private static String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$

private final static String OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
private final static String ELCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$

/**
* Declare all images
*/
private static void declareImages() {
declareRegistryImage(OBJ_FIND_NEXT, OBJ + "select_next.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_FIND_PREV, OBJ + "select_prev.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_FIND_REGEX, OBJ + "regex.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_REPLACE_ALL, OBJ + "replace_all.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_REPLACE, OBJ + "replace.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_WHOLE_WORD, OBJ + "whole_word.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_CASE_SENSITIVE, OBJ + "case_sensitive.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_SEARCH_ALL, OBJ + "search_all.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_SEARCH_IN_AREA, OBJ + "search_in_area.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_OPEN_REPLACE_AREA, OBJ + "open_replace.png"); //$NON-NLS-1$
declareRegistryImage(OBJ_CLOSE_REPLACE_AREA, OBJ + "close_replace.png"); //$NON-NLS-1$
declareRegistryImage(KEY_FIND_NEXT, ELCL + "select_next.png"); //$NON-NLS-1$
declareRegistryImage(KEY_FIND_PREV, ELCL + "select_prev.png"); //$NON-NLS-1$
declareRegistryImage(KEY_FIND_REGEX, ELCL + "regex.png"); //$NON-NLS-1$
declareRegistryImage(KEY_REPLACE_ALL, ELCL + "replace_all.png"); //$NON-NLS-1$
declareRegistryImage(KEY_REPLACE, ELCL + "replace.png"); //$NON-NLS-1$
declareRegistryImage(KEY_WHOLE_WORD, ELCL + "whole_word.png"); //$NON-NLS-1$
declareRegistryImage(KEY_CASE_SENSITIVE, ELCL + "case_sensitive.png"); //$NON-NLS-1$
declareRegistryImage(KEY_SEARCH_ALL, ELCL + "search_all.png"); //$NON-NLS-1$
declareRegistryImage(KEY_SEARCH_IN_AREA, ELCL + "search_in_area.png"); //$NON-NLS-1$
declareRegistryImage(KEY_OPEN_REPLACE_AREA, ELCL + "open_replace.png"); //$NON-NLS-1$
declareRegistryImage(KEY_CLOSE_REPLACE_AREA, ELCL + "close_replace.png"); //$NON-NLS-1$
}

/**
Expand Down

0 comments on commit c93e6c3

Please sign in to comment.