Skip to content

Commit

Permalink
Replace case sensitive checkbox with a button using an icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Jun 21, 2021
1 parent e41e13d commit f2d35f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
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 @@ -321,6 +321,7 @@ public static String getLocation(String fileName, String size) {
String IMAGE_EXPAND_ALL = PATH_PREFIX + "expand_all.gif";
String IMAGE_COLLAPSE_ALL = PATH_PREFIX + "collapse_all.gif";
String IMAGE_SEARCH = PATH_PREFIX + "search.gif";
String IMAGE_CASE_SENSITIVE = PATH_PREFIX + "caseSensitive.png";
String IMAGE_EVALUATE = PATH_PREFIX + "evaluate.gif";
String IMAGE_EVALUATED = PATH_PREFIX + "evaluated.gif";
String IMAGE_VALIDATE = PATH_PREFIX + "validate.gif";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class SearchSupportUI extends Composite {

private Text text;
private Button checkbox;
private Button caseSensitiveButton;
private ISearchListener searchListener;

public SearchSupportUI(Composite parent, int style) {
Expand Down Expand Up @@ -72,7 +72,7 @@ public String getSearchText() {

public boolean isSearchCaseSensitive() {

return checkbox.getSelection();
return PreferenceSupplier.isSearchCaseSensitive();
}

private void createControl() {
Expand All @@ -87,7 +87,7 @@ private void createControl() {
//
createButtonSearch(composite);
text = createTextSearch(composite);
checkbox = createCheckBoxCaseSensitive(composite);
caseSensitiveButton = createButtonCaseSensitive(composite);
}

private Button createButtonSearch(Composite parent) {
Expand Down Expand Up @@ -152,18 +152,21 @@ public void widgetDefaultSelected(SelectionEvent e) {
return text;
}

private Button createCheckBoxCaseSensitive(Composite parent) {
private Button createButtonCaseSensitive(Composite parent) {

Button button = new Button(parent, SWT.CHECK);
Button button = new Button(parent, SWT.PUSH);
button.setText("");
button.setToolTipText("Search Case Sensitive");
button.setSelection(PreferenceSupplier.isSearchCaseSensitive());
boolean active = PreferenceSupplier.isSearchCaseSensitive();
button.setImage(ApplicationImageFactory.getInstance().getImage(IApplicationImage.IMAGE_CASE_SENSITIVE, IApplicationImage.SIZE_16x16, active));
button.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {

PreferenceSupplier.setSearchCaseSensitive(button.getSelection());
boolean active = !PreferenceSupplier.isSearchCaseSensitive();
PreferenceSupplier.setSearchCaseSensitive(active);
button.setImage(ApplicationImageFactory.getInstance().getImage(IApplicationImage.IMAGE_CASE_SENSITIVE, IApplicationImage.SIZE_16x16, active));
runSearch();
}
});
Expand All @@ -175,7 +178,7 @@ private void runSearch() {

if(searchListener != null) {
String searchText = text.getText().trim();
boolean caseSensitive = checkbox.getSelection();
boolean caseSensitive = PreferenceSupplier.isSearchCaseSensitive();
searchListener.performSearch(searchText, caseSensitive);
}
}
Expand Down

0 comments on commit f2d35f2

Please sign in to comment.