From f2d35f23285baf4e2613232f8b4ed4b96f37dfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 21 Jun 2021 11:32:08 +0200 Subject: [PATCH] Replace case sensitive checkbox with a button using an icon. --- .../icons/16x16/caseSensitive.png | Bin 0 -> 1805 bytes .../rcp/ui/icons/core/IApplicationImage.java | 1 + .../swt/ui/components/SearchSupportUI.java | 19 ++++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/caseSensitive.png diff --git a/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/caseSensitive.png b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/icons/16x16/caseSensitive.png new file mode 100644 index 0000000000000000000000000000000000000000..9ecaf8c82f2a04832fb14f911a05f18517c7d87c GIT binary patch literal 1805 zcmV+o2lDudP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U-|ak|Q|?{nshx2m*wb<7kbT8_eocfS9f(q z&(B0>hEpU)2;M`;HvON!hxrQ^Teik&h(395ak=CYX9&^mYma2zdY%`16Q1Aai7Tgd()o%6|UyOW#E z%exBzqbd9e8}344*ORxA%nwP%=<$RML)buelJFGKkN6q;h~W!>m-K?4tw%3+IJTo( zTK)y6qbGfj-$LmzBI0XhevGKrYl#o|jnU#5eP@@QH-O8Zq;9D!35Er5%9`eJ2YeKA zSa-r5ZMGGxHKbaMEqF=9Ky#3zMwtfnHCCz!(Q)U1k+}l*sf!Xgag|Adn>P&(20S#0 z;HH8(fts&aXsw&(dRQ!C$R!eZ3~J0tR)#9FbtQWxFU!_u7)hvsg7Sb$0I;3hg)mL|9u93<(&po&*9{Vk# zgtAdlr>b6qMopT%c<0r7AN=f7IY@9pgAXCZkV1|UUDW7fh%u&^6DL6%QKO!FHC{wbyKrX>>JV-&XtooboPjZR1jfT; z00qsHGaJb{p3F_oY+^C!Qj92dlGA811_oUx)dnB<&EDlXC`&OgE=#) zdtmM(Z*N#@d9_>RKPEkC)$<*QW_oxJD zHQP91_>wCF0XS|4&i0nqwn2??{^XRdz;>+by==;J$tMD@}8y)3CLsoTj*^q&bBy z0&gyn_!V9#Cp=R}tXtnK_Uf92uA=Wp0221hi3eSHbT%82;^@=4;BHSy5v!j1z^WUn z`I~Ky<|cf746Sa);3`x(WrLr7Kc9$`Xcdv4IrR4_n9uR}webgz0M2*-=aBXRoHH8z zb&&oz`s3)S^nHS(-J|qP_k3!a-k&DYZe5$Iy}Eh|X4h+>?`{wp!Or?OYXfX={)@@X zlgr6%?^126jnHq}wf}QR_;=Bg`4_kIhzrJvTx|dV0flKpLr_UWLm*I6Pew^hMF0SJ zoPCi!NW(xJ#a~mkMJf)hAmWgrI$04Fanvdlp+cz@T6HkF^h0RUkfgXc3a$kQKNhPF zF3!3-xC(;c2Z)=SlcI~1_`jskBF2N`e!RQ)xO)c(^)gepURz9|QUZ-MSrx3}g#P9J~_b(OpU4i16gB4w|6ygS(5 z+rMX;{rv!Dq;jG-IjN)o000JJOGiWi{{a60|De66lK=n!32;bRa{vGbS^xkCS^>w* zpx^)i00(qQO+^Rg1{DY~B$k)JM*si-&q+i9@iZ-77HohFf%yE#f&X?&<^mQ za=5`s^cD256th#jMm8h7q=0pN;U`lg9H5L(R0Ft+&IB;=ag+%z7uCcuRwBGNtf7Hb vEN3@(LM`!H#s^Bc#&^8D7Z&d3zhJCiOtC2LeiBEN00000NkvXXu0mjfdE`(0 literal 0 HcmV?d00001 diff --git a/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/src/org/eclipse/chemclipse/rcp/ui/icons/core/IApplicationImage.java b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/src/org/eclipse/chemclipse/rcp/ui/icons/core/IApplicationImage.java index e878edec65..4832f3a185 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/src/org/eclipse/chemclipse/rcp/ui/icons/core/IApplicationImage.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.rcp.ui.icons/src/org/eclipse/chemclipse/rcp/ui/icons/core/IApplicationImage.java @@ -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"; diff --git a/chemclipse/plugins/org.eclipse.chemclipse.swt.ui/src/org/eclipse/chemclipse/swt/ui/components/SearchSupportUI.java b/chemclipse/plugins/org.eclipse.chemclipse.swt.ui/src/org/eclipse/chemclipse/swt/ui/components/SearchSupportUI.java index 803f1fe62f..e52847139f 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.swt.ui/src/org/eclipse/chemclipse/swt/ui/components/SearchSupportUI.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.swt.ui/src/org/eclipse/chemclipse/swt/ui/components/SearchSupportUI.java @@ -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) { @@ -72,7 +72,7 @@ public String getSearchText() { public boolean isSearchCaseSensitive() { - return checkbox.getSelection(); + return PreferenceSupplier.isSearchCaseSensitive(); } private void createControl() { @@ -87,7 +87,7 @@ private void createControl() { // createButtonSearch(composite); text = createTextSearch(composite); - checkbox = createCheckBoxCaseSensitive(composite); + caseSensitiveButton = createButtonCaseSensitive(composite); } private Button createButtonSearch(Composite parent) { @@ -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(); } }); @@ -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); } }